From 3cafc369b174594f0f7e873890aff267233d2209 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Sat, 2 Oct 2010 03:24:13 +0000 Subject: Revert 61269 (broke lots of browser and ui tests, like on your try run) - [GTK] delay reference count check in OwnedWidgetGtk It's a common problem that a GtkWidget will be referenced by an event that's currently on the callstack. These ref holders ignore the "destroy" signal, so when we go to destroy the owned widget, the refcount == 1 DCHECK fails. This change delays that DCHECK until the current stack has unwound, so we don't have to keep running into this. BUG=none TEST=in debug builds, Escape in a constrained window doesn't DCHECK, dragging a tab doesn't cause a DCHECK, pressing the custom frame [x] in lucid doesn't DCHECK; in general, no additional DCHECKs Review URL: http://codereview.chromium.org/3416032 TBR=estade@chromium.org Review URL: http://codereview.chromium.org/3564007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61283 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/tabs/tab_gtk.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'chrome/browser/gtk/tabs') diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index 13e6dbb..148e7ea 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -388,7 +388,12 @@ void TabGtk::EndDrag(bool canceled) { // Make sure we only run EndDrag once by canceling any tasks that want // to call EndDrag. drag_end_factory_.RevokeAll(); - DestroyDragWidget(); + + // We must let gtk clean up after we handle the drag operation, otherwise + // there will be outstanding references to the drag widget when we try to + // destroy it. + MessageLoop::current()->PostTask(FROM_HERE, + destroy_factory_.NewRunnableMethod(&TabGtk::DestroyDragWidget)); if (last_mouse_down_) { gdk_event_free(last_mouse_down_); -- cgit v1.1