diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-09-06 17:28:03 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2013-09-06 17:28:03 -0300 |
commit | 885e34a7c8b3c71be502e8bde35435d5701cdfb7 (patch) | |
tree | cf5d920a6a93b1550aba66b3d2b4221f9a2ec515 | |
parent | e26df66608865fc6b2b5cc04004cfdfd676fbc36 (diff) | |
download | glade-885e34a7c8b3c71be502e8bde35435d5701cdfb7.tar.gz |
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.
-rw-r--r-- | 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 d573b5c2..a1daddd1 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); |