summaryrefslogtreecommitdiff
path: root/dbind
diff options
context:
space:
mode:
authorMike Gorse <mgorse@linux-sh69.site>2013-08-21 14:33:18 -0500
committerMike Gorse <mgorse@linux-sh69.site>2013-08-21 14:33:18 -0500
commitec424c4b688f002af44dd052f4a29feb3868921d (patch)
tree44d99f0b5a001ec9bda1478220250c4d3a96d195 /dbind
parent94106405aad216434789e3a4c4a76c1f47a65959 (diff)
downloadat-spi2-core-ec424c4b688f002af44dd052f4a29feb3868921d.tar.gz
Dispatch dbus messages after method calls when no main loop running
If no main loop is running, then the dbus connection's incoming message queue was never emptied, so with, eg, dogtail, dbus_connection_send_with_reply_and_block would take longer and longer to look through the message queue to find a reply. This also effectively led to a memory leak. https://bugzilla.gnome.org/show_bug.cgi?id=701145
Diffstat (limited to 'dbind')
-rw-r--r--dbind/dbind.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dbind/dbind.c b/dbind/dbind.c
index b83071a2..f10b9cd6 100644
--- a/dbind/dbind.c
+++ b/dbind/dbind.c
@@ -71,7 +71,13 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE
if (unique_name && destination &&
strcmp (destination, unique_name) != 0)
- return dbus_connection_send_with_reply_and_block (bus, message, dbind_timeout, error);
+ {
+ ret = dbus_connection_send_with_reply_and_block (bus, message,
+ dbind_timeout, error);
+ if (g_main_depth () == 0)
+ while (dbus_connection_dispatch (bus) == DBUS_DISPATCH_DATA_REMAINS);
+ return ret;
+ }
closure = g_new0 (SpiReentrantCallClosure, 1);
closure->reply = NULL;