aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-simple.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-11 11:41:15 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-10-11 11:41:15 +0200
commitc16bcdf68c0d1e2d027a5a44b7e3b4bf29d4aee3 (patch)
tree315bcf15472dfb987954d92caff6532a293f8d7c /src/mm-iface-modem-simple.c
parent224b73709956818e3091b68be1966beffbc3ba1b (diff)
core: make sure objects retrieved with g_object_get() are valid in the ifaces
The interfaces usually retrieve objects (e.g. skeletons) from the Modem object using g_object_get(), but we didn't make sure that these objects were actually valid before using them. This should clean up errors happening when the modem gets unplugged and still some actions are ongoing. Should fix https://bugzilla.gnome.org/show_bug.cgi?id=685933
Diffstat (limited to 'src/mm-iface-modem-simple.c')
-rw-r--r--src/mm-iface-modem-simple.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index 952a3c03..a74c03c4 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -643,6 +643,15 @@ connection_step (ConnectionContext *ctx)
g_object_get (ctx->self,
MM_IFACE_MODEM_BEARER_LIST, &list,
NULL);
+ if (!list) {
+ g_dbus_method_invocation_return_error (
+ ctx->invocation,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't get the bearer list");
+ connection_context_free (ctx);
+ return;
+ }
bearer_properties = mm_simple_connect_properties_get_bearer_properties (ctx->properties);
@@ -891,6 +900,16 @@ disconnect_auth_ready (MMBaseModem *self,
g_object_get (self,
MM_IFACE_MODEM_BEARER_LIST, &list,
NULL);
+ if (!list) {
+ g_dbus_method_invocation_return_error (
+ ctx->invocation,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't get the bearer list");
+ disconnection_context_free (ctx);
+ return;
+ }
+
mm_bearer_list_foreach (list,
(MMBearerListForeachFunc)build_connected_bearer_list,
ctx);
@@ -968,8 +987,6 @@ mm_iface_modem_simple_initialize (MMIfaceModemSimple *self)
{
MmGdbusModemSimple *skeleton = NULL;
- g_return_if_fail (MM_IS_IFACE_MODEM_SIMPLE (self));
-
/* Did we already create it? */
g_object_get (self,
MM_IFACE_MODEM_SIMPLE_DBUS_SKELETON, &skeleton,
@@ -1005,8 +1022,6 @@ mm_iface_modem_simple_initialize (MMIfaceModemSimple *self)
void
mm_iface_modem_simple_shutdown (MMIfaceModemSimple *self)
{
- g_return_if_fail (MM_IS_IFACE_MODEM_SIMPLE (self));
-
/* Unexport DBus interface and remove the skeleton */
mm_gdbus_object_skeleton_set_modem_simple (MM_GDBUS_OBJECT_SKELETON (self), NULL);
g_object_set (self,