[nautilus] shell-search-provider: Don't return search provider results on disposal



commit 5441744011ac9b17f8d2bb22fa88c485bc84ecca
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Fri Aug 31 01:49:56 2018 +0200

    shell-search-provider: Don't return search provider results on disposal
    
    If the search provider is disposed while searching, just stop cancel
    the search without sending to the shell any result.

 src/nautilus-shell-search-provider.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index c0da9298a..b60920e9c 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -147,10 +147,24 @@ cancel_current_search (NautilusShellSearchProvider *self)
 {
     if (self->current_search != NULL)
     {
+        g_debug ("*** Cancel current search");
         nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (self->current_search->engine));
     }
 }
 
+static void
+cancel_current_search_ignoring_partial_results (NautilusShellSearchProvider *self)
+{
+    if (self->current_search != NULL)
+    {
+        cancel_current_search (self);
+        g_signal_handlers_disconnect_by_data (G_OBJECT (self->current_search->engine),
+                                              self->current_search);
+        pending_search_finish (self->current_search, self->current_search->invocation,
+                               g_variant_new ("(as)", NULL));
+    }
+}
+
 static void
 search_hits_added_cb (NautilusSearchEngine *engine,
                       GList                *hits,
@@ -754,7 +768,7 @@ search_provider_dispose (GObject *obj)
 
     g_clear_object (&self->skeleton);
     g_hash_table_destroy (self->metas_cache);
-    cancel_current_search (self);
+    cancel_current_search_ignoring_partial_results (self);
 
     G_OBJECT_CLASS (nautilus_shell_search_provider_parent_class)->dispose (obj);
 }


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