diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-05-16 18:58:43 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2011-06-05 17:51:03 +0200 |
commit | d37dbaca2ad66beeeae6e52db1293a3e8a60b7d7 (patch) | |
tree | f5f2ef1350fc7e8d966aa2871bd0fbe97298d8b7 | |
parent | 9323daec015ecad65c39b6020b62e864c027d858 (diff) |
core: ensure ERROR_REMOVED error is used in MMCallbackInfo when detecting modem removal
-rw-r--r-- | src/mm-callback-info.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mm-callback-info.c b/src/mm-callback-info.c index aa1f13ab..a230e690 100644 --- a/src/mm-callback-info.c +++ b/src/mm-callback-info.c @@ -47,19 +47,24 @@ invoke_mm_modem_string_fn (MMCallbackInfo *info) info->error, info->user_data); } - static void modem_destroyed_cb (gpointer data, GObject *destroyed) { MMCallbackInfo *info = data; + /* Reset modem pointer, so that callback know that they shouldn't do + * anything else */ info->modem = NULL; - if (!info->pending_id) { - info->error = g_error_new_literal (MM_MODEM_ERROR, - MM_MODEM_ERROR_REMOVED, - "The modem was removed."); + + /* Overwrite any possible previous error set */ + g_clear_error (&(info->error)); + info->error = g_error_new_literal (MM_MODEM_ERROR, + MM_MODEM_ERROR_REMOVED, + "The modem was removed."); + + /* Only schedule the info if not already done before */ + if (!info->pending_id) mm_callback_info_schedule (info); - } } static void |