diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-06-23 09:59:10 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-06-23 10:04:14 -0400 |
commit | 325cf071d1b6de55eac2a97d8f38558efda17807 (patch) | |
tree | 8425bdae401e89ec707adf35b19ae0f8421d7b35 /gtk/gtknotebook.c | |
parent | b7c498b9bd70c5a4b4e84672645aefbaafaf7691 (diff) | |
download | gtk+-325cf071d1b6de55eac2a97d8f38558efda17807.tar.gz |
GtkNotebook: Maintain invariants during tab dnd
It turns out that we can end up removing a notebook child while
the tab is still 'detached'. Child removal causes
gtk_notebook_remove_tab_label() to be called on the tab label,
but that function did not deal with the eventuality that the tab
label may be a child of the dnd window.
http://bugzilla.gnome.org/show_bug.cgi?id=677943
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r-- | gtk/gtknotebook.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index a7f05d5c7e..214af5668d 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -3150,11 +3150,8 @@ hide_drag_window (GtkNotebook *notebook, { g_object_ref (page->tab_label); - if (GTK_IS_WINDOW (parent)) - { - /* parent widget is the drag window */ - gtk_container_remove (GTK_CONTAINER (parent), page->tab_label); - } + if (GTK_IS_WINDOW (parent)) /* parent widget is the drag window */ + gtk_container_remove (GTK_CONTAINER (parent), page->tab_label); else gtk_widget_unparent (page->tab_label); @@ -4932,7 +4929,17 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook, page->mnemonic_activate_signal = 0; gtk_widget_set_state_flags (page->tab_label, 0, TRUE); - gtk_widget_unparent (page->tab_label); + if (gtk_widget_get_window (page->tab_label) != gtk_widget_get_window (GTK_WIDGET (notebook)) || + !NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page)) + { + GtkWidget *parent; + + 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); + } page->tab_label = NULL; } } |