[gtk/wip/chergert/fix-lookup-with-interfaces] builderparser: fix <lookup/> with interface types




commit 63e9e7e8997543827161d288648b2d8b4b95e439
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 31 15:58:21 2022 -0700

    builderparser: fix <lookup/> with interface types
    
    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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index ccfb1cbc56..c2afb64579 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -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);


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