[nautilus] search-provider: keep a reference to the dbus invocation



commit a4b7dba3aeb6c6aa3e40896ad4d61f8c201fd299
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jan 2 16:22:59 2013 +0100

    search-provider: keep a reference to the dbus invocation
    
    While the operation is in progress, since we're returning the result
    asynchronously, we need to keep a reference to the invocation, or it
    could be invalid when returning later.
    
    Related: https://bugzilla.redhat.com/show_bug.cgi?id=874534

 src/nautilus-shell-search-provider.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 82b5a98..a3e6c20 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -131,6 +131,7 @@ pending_search_free (PendingSearch *search)
   g_hash_table_destroy (search->hits);
   g_clear_object (&search->query);
   g_clear_object (&search->engine);
+  g_clear_object (&search->invocation);
 
   g_slice_free (PendingSearch, search);
 }
@@ -430,7 +431,7 @@ execute_search (NautilusShellSearchProvider *self,
   nautilus_query_set_location (query, home_uri);
 
   pending_search = g_slice_new0 (PendingSearch);
-  pending_search->invocation = invocation;
+  pending_search->invocation = g_object_ref (invocation);
   pending_search->hits = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   pending_search->query = query;
   pending_search->engine = nautilus_search_engine_new ();
@@ -497,6 +498,7 @@ static void
 result_metas_data_free (ResultMetasData *data)
 {
   g_clear_object (&data->self);
+  g_clear_object (&data->invocation);
   g_strfreev (data->uris);
 
   g_slice_free (ResultMetasData, data);
@@ -620,7 +622,7 @@ handle_get_result_metas (NautilusShellSearchProvider2  *skeleton,
 
   data = g_slice_new0 (ResultMetasData);
   data->self = g_object_ref (self);
-  data->invocation = invocation;
+  data->invocation = g_object_ref (invocation);
   data->start_time = g_get_monotonic_time ();
   data->uris = g_strdupv (results);
 



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