[PATCH] service: handle g_sequence when relevant
Tomasz Bursztyka
tomasz.bursztyka
Mon Apr 16 06:13:15 PDT 2012
Do not call g_sequence_sort_changed() when the sequence list is made of
less than 2 sequence iter to avoid such message in the logs:
GLib-CRITICAL: g_sequence_sort_changed: assertion `!is_end (iter)' failed
---
src/service.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/service.c b/src/service.c
index bfd8c7e..bcdcf09 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4119,7 +4119,9 @@ int __connman_service_set_favorite(struct connman_service *service,
favorite_changed(service);
- g_sequence_sort_changed(iter, service_compare, NULL);
+ if (g_sequence_get_length(service_list) > 1)
+ g_sequence_sort_changed(iter, service_compare, NULL);
+
service_schedule_changed();
__connman_connection_update_gateway();
@@ -4455,7 +4457,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();
}
@@ -5169,7 +5171,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();
}
@@ -5470,7 +5472,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);
}
@@ -5572,7 +5574,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();
}
@@ -5738,7 +5740,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();
}
--
1.7.8.5
More information about the Hostap
mailing list