diff options
author | Dan Williams <dcbw@redhat.com> | 2009-11-26 13:40:32 -0800 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2009-11-26 13:40:32 -0800 |
commit | 8dd2421e9c7c2d8afa5af4080eabed41c5689d81 (patch) | |
tree | d82595df931c009d67a0082c0775b23ef2c11373 /src | |
parent | 19e9c0cb480851a6e64ff9b5ce33861765a6e6ee (diff) |
core: don't allow double-scheduled callbacks
If the modem becomes invalid (it crashes and resets, for example)
the callback-info's modem_destroyed_cb() function will handle
cleanup. Buf if the callback-info's callback does more work than
just returning the result (like simple_state_machine) it could
double-schedule the callback. Don't let that happen.
We need better modem-removal handling, but this fixes a crash for
now.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-callback-info.c | 2 | ||||
-rw-r--r-- | src/mm-callback-info.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/mm-callback-info.c b/src/mm-callback-info.c index 0aca55da..089f0b73 100644 --- a/src/mm-callback-info.c +++ b/src/mm-callback-info.c @@ -67,6 +67,7 @@ callback_info_done (gpointer user_data) MMCallbackInfo *info = (MMCallbackInfo *) user_data; info->pending_id = 0; + info->called = TRUE; if (info->invoke_fn && info->callback) info->invoke_fn (info); @@ -94,6 +95,7 @@ mm_callback_info_schedule (MMCallbackInfo *info) { g_return_if_fail (info != NULL); g_return_if_fail (info->pending_id == 0); + g_return_if_fail (info->called == FALSE); info->pending_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, callback_info_do, info, callback_info_done); } diff --git a/src/mm-callback-info.h b/src/mm-callback-info.h index 591ac86e..783e1282 100644 --- a/src/mm-callback-info.h +++ b/src/mm-callback-info.h @@ -28,6 +28,7 @@ struct _MMCallbackInfo { MMCallbackInfoInvokeFn invoke_fn; GCallback callback; + gboolean called; gpointer user_data; GError *error; |