[gtk+] fix race between fetching owner of composit selection, and
- From: Michael Meeks <michael src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] fix race between fetching owner of composit selection, and
- Date: Mon, 14 Sep 2009 14:33:02 +0000 (UTC)
commit db88f084bc83dff85b3c4c6c62a294e8e1c595de
Author: Michael Meeks <michael meeks novell com>
Date: Mon Sep 14 14:27:42 2009 +0100
fix race between fetching owner of composit selection, and
registering as a listener for changes; bug#594913
gdk/x11/gdkdisplay-x11.c | 3 +--
gdk/x11/gdkscreen-x11.c | 18 ++++++++++++++++--
gdk/x11/gdkscreen-x11.h | 1 +
3 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index a384b15..2b10a93 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -402,8 +402,7 @@ gdk_display_open (const gchar *display_name)
_gdk_dnd_init (display);
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
- gdk_display_request_selection_notification (display,
- GDK_SCREEN_X11 (display_x11->screens[i])->cm_selection_atom);
+ _gdk_x11_screen_setup (display_x11->screens[i]);
g_signal_emit_by_name (gdk_display_manager_get(),
"display_opened", display);
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index a668aeb..93d6e4a 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -989,8 +989,6 @@ _gdk_x11_screen_new (GdkDisplay *display,
screen_x11->wmspec_check_window = None;
/* we want this to be always non-null */
screen_x11->window_manager_name = g_strdup ("unknown");
- screen_x11->cm_selection_atom = make_cm_atom (screen_number);
- screen_x11->is_composited = check_is_composited (display, screen_x11);
init_multihead (screen);
init_randr_support (screen);
@@ -1001,6 +999,22 @@ _gdk_x11_screen_new (GdkDisplay *display,
return screen;
}
+/*
+ * It is important that we first request the selection
+ * notification, and then setup the initial state of
+ * is_composited to avoid a race condition here.
+ */
+void
+_gdk_x11_screen_setup (GdkScreen *screen)
+{
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
+
+ screen_x11->cm_selection_atom = make_cm_atom (screen_x11->screen_num);
+ gdk_display_request_selection_notification (screen_x11->display,
+ screen_x11->cm_selection_atom);
+ screen_x11->is_composited = check_is_composited (screen_x11->display, screen_x11);
+}
+
/**
* gdk_screen_is_composited:
* @screen: a #GdkScreen
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index 8a743f5..0d1548c 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -122,6 +122,7 @@ GType _gdk_screen_x11_get_type (void);
GdkScreen * _gdk_x11_screen_new (GdkDisplay *display,
gint screen_number);
+void _gdk_x11_screen_setup (GdkScreen *screen);
void _gdk_x11_screen_window_manager_changed (GdkScreen *screen);
void _gdk_x11_screen_size_changed (GdkScreen *screen,
XEvent *event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]