core: ensure ERROR_REMOVED error is used in MMCallbackInfo when detecting modem removal

This commit is contained in:
Aleksander Morgado
2011-05-16 18:58:43 +02:00
parent 9323daec01
commit d37dbaca2a

View File

@@ -47,20 +47,25 @@ invoke_mm_modem_string_fn (MMCallbackInfo *info)
info->error, info->user_data); info->error, info->user_data);
} }
static void static void
modem_destroyed_cb (gpointer data, GObject *destroyed) modem_destroyed_cb (gpointer data, GObject *destroyed)
{ {
MMCallbackInfo *info = data; MMCallbackInfo *info = data;
/* Reset modem pointer, so that callback know that they shouldn't do
* anything else */
info->modem = NULL; info->modem = NULL;
if (!info->pending_id) {
/* Overwrite any possible previous error set */
g_clear_error (&(info->error));
info->error = g_error_new_literal (MM_MODEM_ERROR, info->error = g_error_new_literal (MM_MODEM_ERROR,
MM_MODEM_ERROR_REMOVED, MM_MODEM_ERROR_REMOVED,
"The modem was removed."); "The modem was removed.");
/* Only schedule the info if not already done before */
if (!info->pending_id)
mm_callback_info_schedule (info); mm_callback_info_schedule (info);
} }
}
static void static void
callback_info_done (gpointer user_data) callback_info_done (gpointer user_data)