From: Marcel Holtmann Date: Sat, 11 Oct 2008 07:24:54 +0000 (+0200) Subject: Change device removal handling X-Git-Tag: 0.1~168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74e2a49df7c7c61b91b3cbc6273c5b49d8603f74;p=platform%2Fupstream%2Fconnman.git Change device removal handling --- diff --git a/plugins/hal.c b/plugins/hal.c index bda2f8c..12d67ef 100644 --- a/plugins/hal.c +++ b/plugins/hal.c @@ -168,6 +168,7 @@ static void device_added(LibHalContext *ctx, const char *udi) static void device_removed(LibHalContext *ctx, const char *udi) { + struct connman_element *removal = NULL; GSList *list; gchar *name; @@ -181,14 +182,18 @@ static void device_removed(LibHalContext *ctx, const char *udi) struct connman_element *element = list->data; if (g_str_equal(element->name, name) == TRUE) { - element_list = g_slist_remove(element_list, element); - - connman_element_unregister(element); - connman_element_unref(element); + removal = element; break; } } + if (removal != NULL) { + element_list = g_slist_remove(element_list, removal); + + connman_element_unregister(removal); + connman_element_unref(removal); + } + g_static_mutex_unlock(&element_mutex); g_free(name);