telepathy-mission-control: mc-debug-server: don' t self-terminate when disconnected from GDBus

Simon McVittie smcv at kemper.freedesktop.org
Mon Oct 8 07:27:44 PDT 2012


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Sep 21 15:37:03 2012 +0100

mc-debug-server: don't self-terminate when disconnected from GDBus

It appears something in MC now connects to D-Bus for a second time,
using GDBus this time. We don't want to exit-on-disconnect for this
one either, again so we free all memory before exiting.

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55391
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 tests/twisted/mc-debug-server.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c
index f1cfa8f..03055e8 100644
--- a/tests/twisted/mc-debug-server.c
+++ b/tests/twisted/mc-debug-server.c
@@ -143,6 +143,7 @@ int
 main (int argc, char **argv)
 {
     GError *error = NULL;
+    GDBusConnection *gdbus = NULL;
     DBusConnection *connection = NULL;
     int ret = 1;
     GMainLoop *teardown_loop;
@@ -165,6 +166,18 @@ main (int argc, char **argv)
     g_log_set_fatal_mask ("GLib-GObject",
         G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
 
+    gdbus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+
+    if (gdbus == NULL)
+    {
+        g_warning ("%s", error->message);
+        g_error_free (error);
+        error = NULL;
+        goto out;
+    }
+
+    g_dbus_connection_set_exit_on_close (gdbus, FALSE);
+
     bus_daemon = tp_dbus_daemon_dup (&error);
 
     if (bus_daemon == NULL)
@@ -236,6 +249,7 @@ out:
         dbus_connection_flush (connection);
     }
 
+    tp_clear_object (&gdbus);
     tp_clear_object (&bus_daemon);
 
     dbus_shutdown ();



More information about the telepathy-commits mailing list