[glade/glade-3-8] Fixed Bug 646259 "SIGSEGV in glade_widget_adaptor_object_construct_object loading ui file" Do not tr



commit 885e34a7c8b3c71be502e8bde35435d5701cdfb7
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Sep 6 17:28:03 2013 -0300

    Fixed Bug 646259 "SIGSEGV in glade_widget_adaptor_object_construct_object loading ui file"
    Do not try to instantiate abstract class objects, this should prevent glade aborting when
    trying to load uninstantiable objects.

 gladeui/glade-widget.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index d573b5c..a1daddd 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3825,11 +3825,13 @@ glade_widget_read (GladeProject *project,
                     glade_xml_get_property_string_required
                     (node, GLADE_XML_TAG_ID, NULL)) != NULL)
                {
+                       adaptor = glade_widget_adaptor_get_by_name (klass);
                        /* 
                         * Create GladeWidget instance based on type. 
                         */
-                       if ((adaptor = 
-                            glade_widget_adaptor_get_by_name (klass)) != NULL)
+                       if (adaptor &&
+                           G_TYPE_IS_INSTANTIATABLE (adaptor->type) &&
+                           G_TYPE_IS_ABSTRACT (adaptor->type) == FALSE)
                        {
 
                                // Internal children !!!
@@ -3868,8 +3870,27 @@ glade_widget_read (GladeProject *project,
                                glade_widget_adaptor_read_widget (adaptor,
                                                                  widget,
                                                                  node);
-
                        }
+                       else if (adaptor)
+                       {
+                               if (G_TYPE_IS_ABSTRACT (adaptor->type))
+                                       glade_util_ui_message (glade_app_get_window (),
+                                                      GLADE_UI_WARN, NULL,
+                                                      "Unable to load widget %s with abstract class %s",
+                                                      id, klass);
+                               else
+                                       glade_util_ui_message (glade_app_get_window (),
+                                                      GLADE_UI_WARN, NULL,
+                                                      "Unable to load widget %s of class %s",
+                                                      id, klass);
+                                       
+                       }
+                       else
+                               glade_util_ui_message (glade_app_get_window (),
+                                                      GLADE_UI_WARN, NULL,
+                                                      "Unable to load widget %s of unknown class %s",
+                                                      id, klass);
+
                        g_free (id);
                }
                g_free (klass);


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