[glade] GladeWidget: Avoid assertions when rebuilding a widget and internal children are missing.



commit 10e8fec5cbaeca1a970f7648d9294ef5d9e58c3f
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon May 13 19:10:25 2013 +0900

    GladeWidget: Avoid assertions when rebuilding a widget and internal children are missing.
    
    Internal children can go missing when changing a construct property which
    decides if the internal child exists, such as the 'has-entry' property
    of GtkComboBox.

 gladeui/glade-widget.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 81deb5f..d585939 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -1759,6 +1759,23 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
                                                             gwidget,
                                                             extract->internal_name);
 
+         /* Some internal children can disappear after a construct only
+          * property has changed, eg. the "has-entry" property of
+          * GtkComboBox decides whether there is an internal entry.
+          *
+          * Just ignore the saved information we have about missing internal
+          * children.
+          */
+         if (!internal_object)
+           {
+             if (extract->properties)
+               g_list_free_full (extract->properties, (GDestroyNotify)g_object_unref);
+
+             g_free (extract->internal_name);
+             g_free (extract);
+             continue;
+           }
+
           gchild = glade_widget_get_from_gobject (internal_object);
 
           /* This will free the list... */


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