Skip to contentSkip to conversation

gdbus: fix not handling bus disconnects

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Oct 13, 2010 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 gdbus: fix not handling bus disconnects

From: Luiz Augusto von Dentz <[email protected]>

We where not dispatching data when a bus disconnects which cause Disconnected signal to not be processed and thus causing the process to either not exit or to not trigger callbacks registered with g_dbus_set_disconnect_function.

To fix this now we always schedule a dispatch which will make sure data still not processed will make its way to the proper handlers even if disconnected.

---
 gdbus/mainloop.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
gdbus/mainloop.c +4 -0
index ec10ab0..862c434 100644
@@ -95,6 +95,7 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
 {
 	struct watch_info *info = data;
 	unsigned int flags = 0;
+	DBusDispatchStatus status;
 
 	dbus_connection_ref(info->conn);
 
@@ -105,6 +106,9 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
 
 	dbus_watch_handle(info->watch, flags);
 
+	status = dbus_connection_get_dispatch_status(info->conn);
+	queue_dispatch(info->conn, status);
+
 	dbus_connection_unref(info->conn);
 
 	return TRUE;
Signature · 1 line
1.7.1
maintainer
#1 lore raw

Hi Luiz,

Quoted 8 lines

We where not dispatching data when a bus disconnects which cause Disconnected signal to not be processed and thus causing the process to either not exit or to not trigger callbacks registered with g_dbus_set_disconnect_function.

To fix this now we always schedule a dispatch which will make sure data still not processed will make its way to the proper handlers even if disconnected.

this looks fine to me. Went ahead and applied to all repositories.

Regards

Marcel