[nautilus] search-engine: keep a reference to the engine while searching



commit 632094e0665ba29558631dfb99f82e7f40b7f8bb
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Oct 18 14:25:13 2012 -0400

    search-engine: keep a reference to the engine while searching
    
    This way, we can ensure the engine will be alive when the providers
    finish.

 libnautilus-private/nautilus-search-engine.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libnautilus-private/nautilus-search-engine.c b/libnautilus-private/nautilus-search-engine.c
index 6d91d1f..fbeabe0 100644
--- a/libnautilus-private/nautilus-search-engine.c
+++ b/libnautilus-private/nautilus-search-engine.c
@@ -83,6 +83,8 @@ search_engine_start_real (NautilusSearchEngine *engine)
 
 	DEBUG ("Search engine start real");
 
+	g_object_ref (engine);
+
 #ifdef ENABLE_TRACKER
 	nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (engine->details->tracker));
 	engine->details->providers_running++;
@@ -182,8 +184,6 @@ check_providers_status (NautilusSearchEngine *engine)
 		return;
 	}
 
-	g_object_ref (engine);
-
 	if (num_finished == engine->details->providers_error) {
 		DEBUG ("Search engine error");
 		nautilus_search_provider_error (NAUTILUS_SEARCH_PROVIDER (engine),
@@ -195,12 +195,13 @@ check_providers_status (NautilusSearchEngine *engine)
 
 	engine->details->running = FALSE;
 	g_hash_table_remove_all (engine->details->uris);
-	g_object_unref (engine);
 
 	if (engine->details->restart) {
 		DEBUG ("Restarting engine");
 		nautilus_search_engine_start (NAUTILUS_SEARCH_PROVIDER (engine));
 	}
+
+	g_object_unref (engine);
 }
 
 static void



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