[nautilus] search-engine-recent: wait the search thread finish to change the run state



commit 3eb23971c662ed1ddd3157c038d6aedda6b7e006
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Nov 8 02:33:20 2018 -0500

    search-engine-recent: wait the search thread finish to change the run state
    
    Don't unset the cancellable on stop and only consider its validity to check if the
    search engine is running, otherwise if we'd nullify the instance when the search
    thread is still running, we might end up in starting a new search, while the thread
    has still to return its values through the idle.
    
    Now, we rely only on the fact that the search thread will eventually join with main
    thread via search_thread_add_hits_idle to notify that the search is over.

 src/nautilus-search-engine-recent.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c
index 2810b5575..a4350a8c3 100644
--- a/src/nautilus-search-engine-recent.c
+++ b/src/nautilus-search-engine-recent.c
@@ -357,9 +357,6 @@ nautilus_search_engine_recent_stop (NautilusSearchProvider *provider)
     {
         DEBUG ("Recent engine stop");
         g_cancellable_cancel (self->cancellable);
-        g_clear_object (&self->cancellable);
-
-        g_object_notify (G_OBJECT (provider), "running");
     }
 }
 
@@ -378,8 +375,7 @@ nautilus_search_engine_recent_is_running (NautilusSearchProvider *provider)
 {
     NautilusSearchEngineRecent *self = NAUTILUS_SEARCH_ENGINE_RECENT (provider);
 
-    return self->cancellable != NULL &&
-           !g_cancellable_is_cancelled (self->cancellable);
+    return self->cancellable != NULL;
 }
 
 static void


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