diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 23:34:57 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 23:34:57 +0000 |
commit | 8533b4b0db6cdbedb2feb40d2ea3a54fb03db963 (patch) | |
tree | 68ed0ecd53549742958c63d9a83a367ddc3e964b /chrome | |
parent | 4a78da0ade4d028c60681c1403fc4a2c2b85a73f (diff) | |
download | chromium_src-8533b4b0db6cdbedb2feb40d2ea3a54fb03db963.zip chromium_src-8533b4b0db6cdbedb2feb40d2ea3a54fb03db963.tar.gz chromium_src-8533b4b0db6cdbedb2feb40d2ea3a54fb03db963.tar.bz2 |
gtk: Two fixes for the tab leak:
* The tab strip handles the lifetime of the tab widget, so don't try to increase the ref count in order to destroy the widget later.
* Use DeleteSoon when deleting the dragged tab in order to give gtk a chance to clean up its ref counts added during the drag operation.
BUG=12863
TEST=Extensive tab dragging. No crashes and the Linux UI valgrind bot should stay green.
Review URL: http://codereview.chromium.org/159166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/tabs/tab_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc index 096f0fe..8394bc4 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_gtk.cc @@ -113,7 +113,6 @@ TabGtk::TabGtk(TabDelegate* delegate) closing_(false), dragging_(false) { event_box_ = gtk_event_box_new(); - g_object_ref(event_box_); gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_), FALSE); gtk_drag_source_set(event_box_, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_MOVE); @@ -150,8 +149,6 @@ TabGtk::~TabGtk() { // Invoke this so that we hide the highlight. ContextMenuClosed(); } - - gtk_widget_destroy(event_box_); } // static diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 191d027..2a884fc 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -829,7 +829,10 @@ void TabStripGtk::DestroyDraggedSourceTab(TabGtk* tab) { } gtk_container_remove(GTK_CONTAINER(tabstrip_.get()), tab->widget()); - delete tab; + // If we delete the dragged source tab here, the gtk drag-n-drop API won't + // get a change to clean up and remove any references it's added to the tab + // widget, so we'll leak the widget. + MessageLoop::current()->DeleteSoon(FROM_HERE, tab); // Force a layout here, because if we've just quickly drag detached a Tab, // the stopping of the active animation above may have left the TabStrip in a |