expression: Fix property expressions for interfaces

We were not checking the passed-in type in the right
way. An interface type can still pass the
g_type_is_a (..., G_TYPE_OBJECT) check, if G_TYPE_OBJECT
is one of its prerequisites. What we need to check is
whether the fundamental type is G_TYPE_OBJECT.
This commit is contained in:
Matthias Clasen 2020-10-30 22:24:53 -04:00
parent 59dd7d8900
commit 48dcbf4935

View File

@ -1283,13 +1283,13 @@ gtk_property_expression_new (GType this_type,
{
GParamSpec *pspec;
if (g_type_is_a (this_type, G_TYPE_OBJECT))
if (g_type_fundamental (this_type) == G_TYPE_OBJECT)
{
GObjectClass *class = g_type_class_ref (this_type);
pspec = g_object_class_find_property (class, property_name);
g_type_class_unref (class);
}
else if (g_type_is_a (this_type, G_TYPE_INTERFACE))
else if (g_type_fundamental (this_type) == G_TYPE_INTERFACE)
{
GTypeInterface *iface = g_type_default_interface_ref (this_type);
pspec = g_object_interface_find_property (iface, property_name);