From 0336b8f89d83998323643e5db8478590f310c256 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 2 Aug 2012 09:23:16 +0200 Subject: [PATCH] iface-modem: don't process signal/act updates if interface is shut down When the interface is shut down the skeleton object no longer exists. Given that we're allowing this actions from outside the interface, we should be safe and don't assume that the caller knows exactly the state of the interface. --- src/mm-iface-modem.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index f0fbb82a..4e3378f6 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -529,6 +529,10 @@ mm_iface_modem_update_access_technologies (MMIfaceModem *self, MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, NULL); + /* Don't process updates if the interface is shut down */ + if (!skeleton) + return; + old_access_tech = mm_gdbus_modem_get_access_technologies (skeleton); /* Build the new access tech */ @@ -754,6 +758,14 @@ update_signal_quality (MMIfaceModem *self, MmGdbusModem *skeleton = NULL; const gchar *dbus_path; + g_object_get (self, + MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, + NULL); + + /* Don't process updates if the interface is shut down */ + if (!skeleton) + return; + if (G_UNLIKELY (!signal_quality_update_context_quark)) signal_quality_update_context_quark = (g_quark_from_static_string ( SIGNAL_QUALITY_UPDATE_CONTEXT_TAG)); @@ -772,10 +784,6 @@ update_signal_quality (MMIfaceModem *self, /* Keep current timestamp */ ctx->last_update = time (NULL); - g_object_get (self, - MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, - NULL); - /* Note: we always set the new value, even if the signal quality level * is the same, in order to provide an up to date 'recent' flag. * The only exception being if 'expire' is FALSE; in that case we assume