[glade] Do not abort if a project has a uninstantiable or abstract class object instead load is as an object
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Do not abort if a project has a uninstantiable or abstract class object instead load is as an object
- Date: Fri, 7 Sep 2012 00:44:55 +0000 (UTC)
commit 3d014fcf54b47a5184ee89d2329c03e575bca790
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Thu Sep 6 21:15:29 2012 -0300
Do not abort if a project has a uninstantiable or abstract class object
instead load is as an object stub and let the user what to do.
Should be enough to close bug #646259
"SIGSEGV in glade_widget_adaptor_object_construct_object loading ui file"
gladeui/glade-object-stub.c | 8 +++++++-
gladeui/glade-widget.c | 8 +++++---
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gladeui/glade-object-stub.c b/gladeui/glade-object-stub.c
index e15ce32..03365b9 100644
--- a/gladeui/glade-object-stub.c
+++ b/gladeui/glade-object-stub.c
@@ -122,11 +122,17 @@ glade_object_stub_refresh_text (GladeObjectStub *stub)
{
GladeObjectStubPrivate *priv = stub->priv;
gchar *markup;
+ GType type;
if (priv->type == NULL) return;
- markup = g_markup_printf_escaped ("<b>FIXME:</b> Unable to create object with type %s", priv->type);
+ type = g_type_from_name (priv->type);
+ if ((type != G_TYPE_INVALID && (!G_TYPE_IS_INSTANTIATABLE (type) || G_TYPE_IS_ABSTRACT (type))))
+ markup = g_markup_printf_escaped ("<b>FIXME:</b> Unable to create uninstantiable object with type %s", priv->type);
+ else
+ markup = g_markup_printf_escaped ("<b>FIXME:</b> Unable to create object with type %s", priv->type);
+
gtk_label_set_markup (priv->label, markup);
gtk_info_bar_set_message_type (GTK_INFO_BAR (stub), GTK_MESSAGE_WARNING);
g_free (markup);
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 4c10096..405856c 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3801,13 +3801,15 @@ glade_widget_read (GladeProject * project,
{
if ((id = glade_xml_get_property_string_required (node, GLADE_XML_TAG_ID, NULL)))
{
+ GType type;
/*
* Create GladeWidget instance based on type.
*/
- if ((adaptor = glade_widget_adaptor_get_by_name (klass)) != NULL)
+ if ((adaptor = glade_widget_adaptor_get_by_name (klass)) &&
+ (type = glade_widget_adaptor_get_object_type (adaptor)) &&
+ G_TYPE_IS_INSTANTIATABLE (type) &&
+ G_TYPE_IS_ABSTRACT (type) == FALSE)
{
-
-
/* Internal children !!! */
if (internal)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]