From 27506acdd852ec19c67c566dc6a1e157e57a941a Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Thu, 30 Jul 2009 19:31:45 +0000 Subject: gtk: Grab the pointer when we grab focus for the source tab's widget. Fixes a crash where events were being sent to an unknown, unrealized widget. BUG=18049 TEST=Quickly drag a tab down out of the tab strip. The browser should not crash. Review URL: http://codereview.chromium.org/160379 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22084 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/tabs/tab_gtk.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'chrome/browser/gtk') diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index 90241100..a8a3ed6 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -217,6 +217,10 @@ void TabGtk::OnDragBegin(GtkWidget* widget, GdkDragContext* context, // static void TabGtk::OnDragEnd(GtkWidget* widget, GdkDragContext* context, TabGtk* tab) { + // Release our grab on the pointer. + gdk_pointer_ungrab(GDK_CURRENT_TIME); + gtk_grab_remove(tab->widget()); + tab->dragging_ = false; // Notify the drag helper that we're done with any potential drag operations. // Clean up the drag helper, which is re-created on the next mouse press. @@ -254,8 +258,11 @@ void TabGtk::DidProcessEvent(GdkEvent* event) { // limbo where the drag is still active, but we don't get any // motion-notify-event signals. Adding the grab back doesn't keep the // drag alive, but it does get us out of this bind by finishing the drag. - if (delegate_->IsTabDetached(this)) + if (delegate_->IsTabDetached(this)) { + gdk_pointer_grab(widget()->window, FALSE, GDK_POINTER_MOTION_HINT_MASK, + NULL, NULL, GDK_CURRENT_TIME); gtk_grab_add(widget()); + } break; default: break; -- cgit v1.1