2013-01-04 01:50:34

by Lucas De Marchi

[permalink] [raw]
Subject: [RFC] gdbus: Process changes upon ObjectManager.GetManagedObjects

From: Lucas De Marchi <[email protected]>

If ObjectManager.GetManagedObjects is called, we need to flush all
pending signals for interfaces added/removed, otherwise we might answer
the method saying an interface exists but never send a signal when it's
removed.
---

It's an RFC because it's untested. If anyone can write a proper unit test for
this, it would be good. Otherwise I can probably do it in the weekend.

gdbus/object.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/gdbus/object.c b/gdbus/object.c
index 2b6ae31..3d9ab5f 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1108,6 +1108,11 @@ static DBusMessage *get_objects(DBusConnection *connection,
if (reply == NULL)
return NULL;

+ if (data->process_id > 0) {
+ g_source_remove(data->process_id);
+ process_changes(data);
+ }
+
dbus_message_iter_init_append(reply, &iter);

dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
--
1.8.1