builderparser: fix <lookup/> with interface types
authorChristian Hergert <chergert@redhat.com>
Tue, 31 May 2022 22:58:21 +0000 (15:58 -0700)
committerChristian Hergert <chergert@redhat.com>
Tue, 31 May 2022 22:58:21 +0000 (15:58 -0700)
If we have a <lookup name="foo" type="SomeInterface"> a runtime warning
would be emitted and the expression would fail to be created. This is
because the interfaces will likely be a GObject as well, meaning we check
the object type branch instead of the interface.

Instead, we need to use the fundamental type like other parts of the
expression system use.

gtk/gtkbuilderparser.c

index ccfb1cbc565a53bcfd946a8bbea26e4edbf19961..c2afb645793817b4e6fde8ee59be58575fbb11c9 100644 (file)
@@ -1409,13 +1409,13 @@ expression_info_construct (GtkBuilder      *builder,
             return NULL;
           }
 
-        if (g_type_is_a (type, G_TYPE_OBJECT))
+        if (g_type_fundamental (type) == G_TYPE_OBJECT)
           {
             GObjectClass *class = g_type_class_ref (type);
             pspec = g_object_class_find_property (class, info->property.property_name);
             g_type_class_unref (class);
           }
-        else if (g_type_is_a (type, G_TYPE_INTERFACE))
+        else if (g_type_fundamental (type) == G_TYPE_INTERFACE)
           {
             GTypeInterface *iface = g_type_default_interface_ref (type);
             pspec = g_object_interface_find_property (iface, info->property.property_name);