summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-07-31 20:17:54 +0200
committerCosimo Cecchi <cosimoc@gnome.org>2012-07-31 20:17:54 +0200
commitc1218f964a8c541f8e82d42463be02a25eb36be9 (patch)
tree28f434aa05d77a2c2c5ac5a51d5dc966ce1b819d /gtk/gtknotebook.c
parent844e793246f4f0b31ee3dcebc64fffc058c576e1 (diff)
downloadgtk+-c1218f964a8c541f8e82d42463be02a25eb36be9.tar.gz
notebook: restore previous behaviour wrt. unparenting of tab labels
When the tab label gets removed from the notebook on widget desctruction, we should still unconditionally unparent it from the notebook, since failing to do so will keep a stray reference alive. In case applications rely on the tab label being destroyed to release other references (e.g. because the tab label is a custom object, or another object's lifecycle is tied to it using g_object_set_data_full()), this will also possibly cause other references to get leaked. In Nautilus, the result was we were failing to release the reference to a NautilusWindowSlot, and other parts of the application relied on it being destroyed at a specific time instead, causing the application to crash when closing a window. This is a regression from commit 325cf071d1b6de55eac2a97d8f38558efda17807. This commit restores the previous unparenting behavior in case we're not in a DnD operation. https://bugzilla.gnome.org/show_bug.cgi?id=680349
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5be63f6436..c414a16079 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4934,12 +4934,18 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook,
{
GtkWidget *parent;
+ /* we hit this condition during dnd of a detached tab */
parent = gtk_widget_get_parent (page->tab_label);
if (GTK_IS_WINDOW (parent))
gtk_container_remove (GTK_CONTAINER (parent), page->tab_label);
else
gtk_widget_unparent (page->tab_label);
}
+ else
+ {
+ gtk_widget_unparent (page->tab_label);
+ }
+
page->tab_label = NULL;
}
}