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,19 +47,24 @@ 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) {
info->error = g_error_new_literal (MM_MODEM_ERROR, /* Overwrite any possible previous error set */
MM_MODEM_ERROR_REMOVED, g_clear_error (&(info->error));
"The modem was removed."); 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); mm_callback_info_schedule (info);
}
} }
static void static void