[next] telepathy-mission-control: mc-debug-server: if we have several reasons to stop, don't crash

Simon McVittie smcv at kemper.freedesktop.org
Thu Apr 3 07:28:07 PDT 2014


Module: telepathy-mission-control
Branch: next
Commit: 9ea179a97d957e41be9eccc03236e254220c3ad2
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=9ea179a97d957e41be9eccc03236e254220c3ad2

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Apr  2 12:25:40 2014 +0100

mc-debug-server: if we have several reasons to stop, don't crash

Previously, when the session and (fake) system bus closed (simultaneously,
because they are in fact the same dbus-daemon), we would call
mcd_mission_abort() for the first one. That results in
a call to tp_clear_object (&mcd), and then the second call to
mcd_mission_abort (mcd) would crash with a critical warning, because
MCD_IS_MISSION (NULL) is false.

---

 tests/twisted/mc-debug-server.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c
index 644dd40..33da426 100644
--- a/tests/twisted/mc-debug-server.c
+++ b/tests/twisted/mc-debug-server.c
@@ -57,7 +57,12 @@ bus_closed (GDBusConnection *connection,
         g_quark_to_string (error->domain), error->code, error->message);
 
   g_dbus_connection_set_exit_on_close (connection, FALSE);
-  mcd_mission_abort ((McdMission *) mcd);
+
+  if (mcd != NULL)
+    {
+      g_message ("Aborting because D-Bus connection has closed");
+      mcd_mission_abort ((McdMission *) mcd);
+    }
 }
 
 static gboolean
@@ -79,9 +84,17 @@ on_abort (gpointer unused G_GNUC_UNUSED)
 static gboolean
 delayed_abort (gpointer data G_GNUC_UNUSED)
 {
-    g_message ("Aborting by popular request");
-    mcd_mission_abort ((McdMission *) mcd);
-    return FALSE;
+  if (mcd != NULL)
+    {
+      g_message ("Aborting as requested via D-Bus");
+      mcd_mission_abort ((McdMission *) mcd);
+    }
+  else
+    {
+      g_message ("mcd has already gone away");
+    }
+
+  return FALSE;
 }
 
 static gboolean



More information about the telepathy-commits mailing list