Don't call dbus_connection_dispatch recursively
authorMike Gorse <mgorse@suse.com>
Mon, 2 Sep 2013 17:28:27 +0000 (12:28 -0500)
committerMike Gorse <mgorse@suse.com>
Mon, 2 Sep 2013 17:28:27 +0000 (12:28 -0500)
dbus_connection_dispatch is trying to lock the connection when it is
already locked, resulting in a deadlock, so just don't call it
recursively for now.

dbind/dbind.c

index f10b9cd..d85a9e5 100644 (file)
@@ -68,14 +68,19 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE
   const char *destination = dbus_message_get_destination (message);
   struct timeval tv;
   DBusMessage *ret;
+  static gboolean in_dispatch = FALSE;
 
   if (unique_name && destination &&
       strcmp (destination, unique_name) != 0)
     {
       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);
+      if (g_main_depth () == 0 && !in_dispatch)
+      {
+        in_dispatch = TRUE;
+        while (dbus_connection_dispatch (bus) == DBUS_DISPATCH_DATA_REMAINS);
+        in_dispatch = FALSE;
+      }
       return ret;
     }