telepathy-mission-control: mc-debug-server: don' t exit when disconnected from system bus

Simon McVittie smcv at kemper.freedesktop.org
Thu Jan 30 04:34:40 PST 2014


Module: telepathy-mission-control
Branch: master
Commit: b69fcaca8a6c6d60c1106178d1285ef29466c189
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=b69fcaca8a6c6d60c1106178d1285ef29466c189

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Nov 13 17:07:46 2013 +0000

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.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727

---

 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 ();



More information about the telepathy-commits mailing list