aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-10-08 09:53:28 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-10-08 09:53:28 +0200
commit8d47d31b29ebec367dfbc64782961d7c30a0a83e (patch)
treee4f0164f6ae1fdd205fe90d102314fcac64bc3df /src
parent41cc66f33adc81d19246dfb8c3beeed3aff6a1e3 (diff)
broadband-modem: cancellable may not be given during disable()
If the modem is currently being disposed, we may not get a proper GCancellable when disabling, so try to handle that case in order to avoid warnings like: GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed #0 0x00007ffff7ab1ba0 in g_log () from /usr/lib64/libglib-2.0.so.0 #1 0x00007ffff7b99784 in g_object_ref () from /usr/lib64/libgobject-2.0.so.0 #2 0x0000000000456c05 in disable (self=0x50d3f0, cancellable=0x0, callback=<value optimized out>, user_data=<value optimized out>) at mm-broadband-modem.c:7052 #3 0x0000000000431e69 in handle_enable_auth_ready (self=0x50d3f0, res=<value optimized out>, ctx=0xa41200) at mm-iface-modem.c:1216 #4 0x00007ffff7e7f447 in g_simple_async_result_complete () from /usr/lib64/libgio-2.0.so.0 #5 0x0000000000427bc1 in authorize_ready (authp=<value optimized out>, res=<value optimized out>, simple=0x51d810) at mm-base-modem.c:1015 #6 0x00007ffff7e7f447 in g_simple_async_result_complete () from /usr/lib64/libgio-2.0.so.0 #7 0x00007ffff7e7f549 in ?? () from /usr/lib64/libgio-2.0.so.0 #8 0x00007ffff7aaa5c3 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #9 0x00007ffff7aaa940 in ?? () from /usr/lib64/libglib-2.0.so.0 #10 0x00007ffff7aaad7a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0 #11 0x0000000000417ef2 in main (argc=<value optimized out>, argv=<value optimized out>) at main.c:150 GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed #0 0x00007ffff7ab1ba0 in g_log () from /usr/lib64/libglib-2.0.so.0 #1 0x000000000044af26 in disabling_context_complete_and_free (ctx=0xa408a0) at mm-broadband-modem.c:6788 #2 0x0000000000431e69 in handle_enable_auth_ready (self=0x50d3f0, res=<value optimized out>, ctx=0xa41200) at mm-iface-modem.c:1216 #3 0x00007ffff7e7f447 in g_simple_async_result_complete () from /usr/lib64/libgio-2.0.so.0 #4 0x0000000000427bc1 in authorize_ready (authp=<value optimized out>, res=<value optimized out>, simple=0x51d810) at mm-base-modem.c:1015 #5 0x00007ffff7e7f447 in g_simple_async_result_complete () from /usr/lib64/libgio-2.0.so.0 #6 0x00007ffff7e7f549 in ?? () from /usr/lib64/libgio-2.0.so.0 #7 0x00007ffff7aaa5c3 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #8 0x00007ffff7aaa940 in ?? () from /usr/lib64/libglib-2.0.so.0 #9 0x00007ffff7aaad7a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0 #10 0x0000000000417ef2 in main (argc=<value optimized out>, argv=<value optimized out>) at main.c:150 Reported by: Ben Chan <benchan@chromium.org> Partially fixes: https://bugzilla.gnome.org/show_bug.cgi?id=684693
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index c3f02c0b..7423130a 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -6813,7 +6813,8 @@ disabling_context_complete_and_free (DisablingContext *ctx)
}
g_object_unref (ctx->result);
- g_object_unref (ctx->cancellable);
+ if (ctx->cancellable)
+ g_object_unref (ctx->cancellable);
g_object_unref (ctx->self);
g_free (ctx);
}
@@ -6837,10 +6838,7 @@ disable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error)
{
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
- return FALSE;
-
- return TRUE;
+ return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
#undef INTERFACE_DISABLE_READY_FN
@@ -7079,12 +7077,12 @@ disable (MMBaseModem *self,
ctx = g_new0 (DisablingContext, 1);
ctx->self = g_object_ref (self);
ctx->result = result;
- ctx->cancellable = g_object_ref (cancellable);
+ ctx->cancellable = (cancellable ? g_object_ref (cancellable) : NULL);
ctx->step = DISABLING_STEP_FIRST;
disabling_step (ctx);
return;
- }
+ }
}
g_simple_async_result_complete_in_idle (result);