[Spice-devel] [PATCH] spicec-x11: Fix going into a never ending loop upon xrandr event (#628573) (v2)
Alon Levy
alevy at redhat.com
Sun Sep 5 00:13:13 PDT 2010
----- "Hans de Goede" <hdegoede at redhat.com> wrote:
> When handling an xrandr event the
> event_listener->on_monitors_change()
> callback destroys and re-creates the monitor object(s) which results
> in the DynamicScreen or MultyMonconstructor being called, which
> triggers
> more xrandr events. This causes a never ending event handling loop
> making
> spicec hang, and eventually making the X-server crash as a backlog
> of events builds up and it oom's.
>
> This patches this by explictly processing the xrandr event caused
> by the constructor inside the constructor surrounded by the already
> present guard code against recursive xrandr events.
> ---
> client/x11/platform.cpp | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
> index 8292d44..cc1502b 100644
> --- a/client/x11/platform.cpp
> +++ b/client/x11/platform.cpp
> @@ -778,6 +778,11 @@ DynamicScreen::DynamicScreen(Display* display,
> int screen, int& next_mon_id)
> platform_win = XCreateSimpleWindow(display, RootWindow(display,
> screen), 0, 0, 1, 1, 0, 0, 0);
> XSelectInput(display, platform_win, StructureNotifyMask);
> XRRSelectInput(display, platform_win, RRScreenChangeNotifyMask);
> +
> + Monitor::self_monitors_change++;
> + process_monitor_configure_events(platform_win);
> + Monitor::self_monitors_change--;
> +
> XPlatform::set_win_proc(platform_win, root_win_proc);
> intern_clipboard_atoms();
> X_DEBUG_SYNC(display);
> @@ -1046,6 +1051,11 @@ MultyMonScreen::MultyMonScreen(Display*
> display, int screen, int& next_mon_id)
> X_DEBUG_SYNC(get_display());
> intern_clipboard_atoms();
> XPlatform::set_win_proc(root_window, root_win_proc);
> +
> + XMonitor::inc_change_ref();
> + process_monitor_configure_events(root_window);
> + XMonitor::dec_change_ref();
> +
> X_DEBUG_SYNC(get_display());
> //
> //platform_win = XCreateSimpleWindow(display, RootWindow(display,
> screen), 0, 0, 1, 1, 0, 0, 0);
> --
> 1.7.2.2
>
This is a little magic, I can't see anyone looking at this later and understanding (except by doing git blame). Still, ACK.
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list