summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2013-01-04 01:33:44 -0200
committerMarcel Holtmann <marcel@holtmann.org>2013-01-03 21:34:42 -0800
commit4ca82ab3553a289f0ca29945597fac0c880bc301 (patch)
tree5017cf29e9abf591a22dfd41b7b43c87442a3351 /gdbus
parentce3ffd4786b8d4c7239889fada2c326766a96ca2 (diff)
downloadconnman-4ca82ab3553a289f0ca29945597fac0c880bc301.tar.gz
connman-4ca82ab3553a289f0ca29945597fac0c880bc301.tar.bz2
connman-4ca82ab3553a289f0ca29945597fac0c880bc301.zip
gdbus: Don't include just added interfaces in GetManagedObjects
If we received a call to ObjectManager.GetManagedObject we should not include in the response the interfaces in data->added. This is because it's not guaranteed that those interfaces will trigger an InterfacesAdded signal, which is the case if the interface is removed in the same mainloop iteration.
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/object.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index 2b6ae311..e569acb9 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1064,6 +1064,7 @@ static const GDBusMethodTable introspect_methods[] = {
static void append_interfaces(struct generic_data *data, DBusMessageIter *iter)
{
DBusMessageIter array;
+ GSList *l;
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
@@ -1075,7 +1076,12 @@ static void append_interfaces(struct generic_data *data, DBusMessageIter *iter)
DBUS_DICT_ENTRY_END_CHAR_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &array);
- g_slist_foreach(data->interfaces, append_interface, &array);
+ for (l = data->interfaces; l != NULL; l = l->next) {
+ if (g_slist_find(data->added, l->data))
+ continue;
+
+ append_interface(l->data, &array);
+ }
dbus_message_iter_close_container(iter, &array);
}