[gtk+/composite-templates] GtkNotebook: Maintain invariants during tab dnd
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] GtkNotebook: Maintain invariants during tab dnd
- Date: Tue, 26 Jun 2012 22:38:44 +0000 (UTC)
commit dce3db9f280415d75f0636d3e4832d146aad7ff8
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 23 09:59:10 2012 -0400
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
gtk/gtknotebook.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index a7f05d5..214af56 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]