From 7d5ff7799a67db35a027e90ee828a1f31669508f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Wed, 13 Oct 2010 15:50:31 +0200 Subject: [PATCH] core: fix property handling when one introspection XML contains multiple interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a regression caused by 510bdcd63ae4e588a5cb72727696d5ad7fd5298b "Respect property access flags for writing, allow disabling for reads". When exported_properties of DBusGObjectInfo contain multiple interfaces, scan them all to find queried interface during property access check. Signed-off-by: Jiří Klimeš --- dbus/dbus-gobject.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index 65af51a..256d64b 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -483,6 +483,32 @@ lookup_object_info (GObject *object) return info_list; } +/* Look up interface_name in exported_properties of introspection data object. */ +static gboolean +find_interface_name (const DBusGObjectInfo *object, + const char *interface_name) +{ + const char *properties_iter; + + properties_iter = object->exported_properties; + while (properties_iter != NULL && *properties_iter) + { + const char *cur_interface_name; + const char *cur_property_name; + const char *cur_uscore_property_name; + const char *cur_access_type; + + properties_iter = property_iterate (properties_iter, object->format_version, + &cur_interface_name, &cur_property_name, + &cur_uscore_property_name, &cur_access_type); + + if (interface_name && strcmp (interface_name, cur_interface_name) == 0) + return TRUE; + } + + return FALSE; +} + typedef struct { const char *iface; const DBusGObjectInfo *info; @@ -503,7 +529,7 @@ lookup_object_info_by_iface_cb (const DBusGObjectInfo *info, lookup_data->info = info; lookup_data->iface_type = gtype; } - else if (info->exported_properties && !strcmp (info->exported_properties, lookup_data->iface)) + else if (find_interface_name (info, lookup_data->iface)) { lookup_data->info = info; lookup_data->iface_type = gtype; -- 1.7.2.3