[glade/composite-templates-new: 3/9] GtkNotebook adaptor: Safer treatment of child tabs



commit c009f66e1644bb982d6dab37c58dd56983e267f6
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Apr 5 15:13:28 2013 +0900

    GtkNotebook adaptor: Safer treatment of child tabs
    
    Hold an extra temporary reference in glade_gtk_notebook_extract_children()

 plugins/gtk+/glade-gtk.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 988c46f..bd6f174 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1746,12 +1746,19 @@ glade_gtk_notebook_extract_children (GtkWidget * notebook)
       GtkWidget *page = gtk_notebook_get_nth_page (nb, 0);
       GtkWidget *tab = gtk_notebook_get_tab_label (nb, page);
 
+      if (tab)
+       g_object_ref (tab);
+
       /* Explicitly remove the tab label first */
       gtk_notebook_set_tab_label (nb, page, NULL);
 
       /* FIXE: we need to unparent here to avoid anoying warning when reparenting */
-      if (tab) gtk_widget_unparent (tab);
-      
+      if (tab)
+       {
+         gtk_widget_unparent (tab);
+         g_object_unref (tab);
+       }
+
       gtk_notebook_remove_page (nb, 0);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]