From c40e7c6ce7f5686fa6f5765103727a6e69112c5a Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 2 Sep 2013 12:28:27 -0500 Subject: [PATCH] Don't call dbus_connection_dispatch recursively 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dbind/dbind.c b/dbind/dbind.c index f10b9cd..d85a9e5 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -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; } -- 2.7.4