From fbcc9535da1a65da165a23e8c982e14151e82c3f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Nov 2013 17:07:46 +0000 Subject: [PATCH 11/26] mc-debug-server: don't exit when disconnected from system bus The session bus is our fake system bus, too. We exit when libdbus tells us we have disconnected, and ignore both the possible ways in which GDBus can kill us, in order to get coverage stats. --- tests/twisted/mc-debug-server.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c index 48f0248..917a5d3 100644 --- a/tests/twisted/mc-debug-server.c +++ b/tests/twisted/mc-debug-server.c @@ -154,6 +154,7 @@ main (int argc, char **argv) { GError *error = NULL; GDBusConnection *gdbus = NULL; + GDBusConnection *gdbus_system = NULL; DBusConnection *connection = NULL; int ret = 1; GMainLoop *teardown_loop; @@ -185,6 +186,18 @@ main (int argc, char **argv) g_dbus_connection_set_exit_on_close (gdbus, FALSE); + gdbus_system = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); + + if (gdbus_system == NULL) + { + g_warning ("%s", error->message); + g_error_free (error); + error = NULL; + goto out; + } + + g_dbus_connection_set_exit_on_close (gdbus_system, FALSE); + bus_daemon = tp_dbus_daemon_dup (&error); if (bus_daemon == NULL) @@ -238,6 +251,7 @@ out: } tp_clear_object (&gdbus); + tp_clear_object (&gdbus_system); tp_clear_object (&bus_daemon); dbus_shutdown (); -- 1.8.4.3