Commit 3d014fcf authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

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"
parent b25ee612
......@@ -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);
......
......@@ -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)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment