From: Tomasz Bursztyka Date: Thu, 19 Apr 2012 09:35:12 +0000 (+0300) Subject: service: fix glib critical messages about g_sequence_sort_changed X-Git-Tag: 0.81~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d4034d013c14ff303bd21b9cf5035001f2fd798;p=platform%2Fupstream%2Fconnman.git service: fix glib critical messages about g_sequence_sort_changed This patch fixes this: GLib-CRITICAL **: g_sequence_sort_changed: assertion `!is_end (iter)' failed --- diff --git a/src/service.c b/src/service.c index 35b7aba..a0e8a11 100644 --- a/src/service.c +++ b/src/service.c @@ -4208,8 +4208,10 @@ int __connman_service_set_favorite(struct connman_service *service, favorite_changed(service); - g_sequence_sort_changed(iter, service_compare, NULL); - service_schedule_changed(); + if (g_sequence_get_length(service_list) > 1) { + g_sequence_sort_changed(iter, service_compare, NULL); + service_schedule_changed(); + } __connman_connection_update_gateway(); @@ -4587,7 +4589,7 @@ static int service_indicate_state(struct connman_service *service) service->error = CONNMAN_SERVICE_ERROR_UNKNOWN; iter = g_hash_table_lookup(service_hash, service->identifier); - if (iter != NULL) { + if (iter != NULL && g_sequence_get_length(service_list) > 1) { g_sequence_sort_changed(iter, service_compare, NULL); service_schedule_changed(); } @@ -5303,7 +5305,7 @@ static int service_register(struct connman_service *service) NULL, service, NULL); iter = g_hash_table_lookup(service_hash, service->identifier); - if (iter != NULL) { + if (iter != NULL && g_sequence_get_length(service_list) > 1) { g_sequence_sort_changed(iter, service_compare, NULL); service_schedule_changed(); } @@ -5604,7 +5606,7 @@ void __connman_service_update_ordering(void) GSequenceIter *iter; iter = g_sequence_get_begin_iter(service_list); - if (iter != NULL) + if (iter != NULL && g_sequence_get_length(service_list) > 1) g_sequence_sort_changed(iter, service_compare, NULL); } @@ -5706,7 +5708,7 @@ static void update_from_network(struct connman_service *service, service->network = connman_network_ref(network); iter = g_hash_table_lookup(service_hash, service->identifier); - if (iter != NULL) { + if (iter != NULL && g_sequence_get_length(service_list) > 1) { g_sequence_sort_changed(iter, service_compare, NULL); service_schedule_changed(); } @@ -5872,7 +5874,7 @@ roaming: sorting: if (need_sort == TRUE) { iter = g_hash_table_lookup(service_hash, service->identifier); - if (iter != NULL) { + if (iter != NULL && g_sequence_get_length(service_list) > 1) { g_sequence_sort_changed(iter, service_compare, NULL); service_schedule_changed(); }