[nautilus] search-engine: fix wrong logic for avoiding duplicates



commit 7f04862303d757e0f54f23b91d4b3775d24c6d72
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Sep 5 20:28:30 2012 -0400

    search-engine: fix wrong logic for avoiding duplicates
    
    count++ first returns count and then increments it, where we want the
    opposite.
    This fixes the warnings like
    WARNING **: file already in tree (parent_ptr: (nil))!!!

 libnautilus-private/nautilus-search-engine.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-engine.c b/libnautilus-private/nautilus-search-engine.c
index d06017d..d7e4e72 100644
--- a/libnautilus-private/nautilus-search-engine.c
+++ b/libnautilus-private/nautilus-search-engine.c
@@ -104,7 +104,7 @@ search_provider_hits_added (NautilusSearchProvider *provider,
 		count = GPOINTER_TO_INT (g_hash_table_lookup (engine->details->uris, uri));
 		if (count == 0)
 			added = g_list_prepend (added, hit);
-		g_hash_table_replace (engine->details->uris, g_strdup (uri), GINT_TO_POINTER (count++));
+		g_hash_table_replace (engine->details->uris, g_strdup (uri), GINT_TO_POINTER (++count));
 	}
 	if (added != NULL) {
 		added = g_list_reverse (added);
@@ -133,7 +133,7 @@ search_provider_hits_subtracted (NautilusSearchProvider *provider,
 			removed = g_list_prepend (removed, hit);
 			g_hash_table_remove (engine->details->uris, uri);
 		} else {
-			g_hash_table_replace (engine->details->uris, g_strdup (uri), GINT_TO_POINTER (count--));
+			g_hash_table_replace (engine->details->uris, g_strdup (uri), GINT_TO_POINTER (--count));
 		}
 	}
 	if (removed != NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]