summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 21:35:51 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 21:35:51 +0000
commit6913b5479f4f12fc9f883d6c8567cea73e05a43f (patch)
tree9c560e42e2f5278b7833f5a90323a164c2c3a49e
parent7ec85699f7b394c8b84a4f0289de49969a0846a2 (diff)
downloadchromium_src-6913b5479f4f12fc9f883d6c8567cea73e05a43f.zip
chromium_src-6913b5479f4f12fc9f883d6c8567cea73e05a43f.tar.gz
chromium_src-6913b5479f4f12fc9f883d6c8567cea73e05a43f.tar.bz2
gtk: Grab server when restacking windows.
Otherwise, it's possible for the window manager to reparent the toplevel window right before we try to stack the first-run bubble above it, leading to a crash (since the two windows are no longer siblings). BUG=30498 TEST=not yet Review URL: http://codereview.chromium.org/545126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36897 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/gtk_util.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 62b7465..36484a3 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -662,9 +662,12 @@ void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) {
GTK_WIDGET_REALIZED(toplevel));
// Stack the |popup| window directly above the |toplevel| window.
- // The |popup| window is a direct child of the root window, so we need to
+ // The popup window is a direct child of the root window, so we need to
// find a similar ancestor for the toplevel window (which might have been
- // reparented by a window manager).
+ // reparented by a window manager). We grab the server while we're doing
+ // this -- otherwise, we'll get an error if the window manager reparents the
+ // toplevel window right after we call GetHighestAncestorWindow().
+ gdk_x11_display_grab(gtk_widget_get_display(toplevel));
XID toplevel_window_base = x11_util::GetHighestAncestorWindow(
x11_util::GetX11WindowFromGtkWidget(toplevel),
x11_util::GetX11RootWindow());
@@ -681,6 +684,7 @@ void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) {
<< x11_util::GetX11RootWindow();
}
}
+ gdk_x11_display_ungrab(gtk_widget_get_display(toplevel));
}
gfx::Rect GetWidgetRectRelativeToToplevel(GtkWidget* widget) {