Patchwork service: handle g_sequence when relevant

login
register
mail settings
Submitter Tomasz Bursztyka
Date April 16, 2012, 1:13 p.m.
Message ID <1334581995-9761-1-git-send-email-tomasz.bursztyka@linux.intel.com>
Download mbox | patch
Permalink /patch/152856/
State Not Applicable
Headers show

Comments

Tomasz Bursztyka - April 16, 2012, 1:13 p.m.
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(-)
Marcel Holtmann - April 16, 2012, 1:13 p.m.
Hi Tomasz,

> 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(-)

you realized that you picked the wrong mailing list for this patch ;)

Regards

Marcel
Tomasz Bursztyka - April 16, 2012, 1:18 p.m.
Oh no  /o\

Sorry for the annoyance.

Tomasz

Le 16/04/2012 16:13, Marcel Holtmann a écrit :
> Hi Tomasz,
>
>> 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(-)
> you realized that you picked the wrong mailing list for this patch ;)
>
> Regards
>
> Marcel
>
>
>

Patch

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();
 		}