Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] gdbus: Don't include just added interfaces in GetManagedObjects
@ 2013-01-04  3:33 Lucas De Marchi
  2013-01-04  5:36 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas De Marchi @ 2013-01-04  3:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

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.
---
 gdbus/object.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 2b6ae31..e569acb 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);
 }
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-04  5:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04  3:33 [PATCH BlueZ] gdbus: Don't include just added interfaces in GetManagedObjects Lucas De Marchi
2013-01-04  5:36 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox