diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-02 12:25:40 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-02 12:25:40 +0100 |
commit | 9ea179a97d957e41be9eccc03236e254220c3ad2 (patch) | |
tree | 0c048b26c646cd99c65ada5156cdea596770a0a3 | |
parent | 1735c79109e8ade53709c72144e74caaa9c54c40 (diff) |
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.
-rw-r--r-- | tests/twisted/mc-debug-server.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c index 644dd400..33da4264 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 |