[tracker] libtracker-miner: Abort async operations once the instance is gone



commit 864aabbe4d5c4fb7fd9b0813c25a337240df6235
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 20 17:47:46 2015 +0200

    libtracker-miner: Abort async operations once the instance is gone
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756869

 src/libtracker-miner/tracker-file-notifier.c |   33 ++++++++++++++++++-------
 1 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 50105aa..93b123b 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -670,19 +670,27 @@ sparql_contents_query_cb (GObject      *object,
        TrackerSparqlCursor *cursor;
        GError *error = NULL;
 
-       notifier = user_data;
-
        cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
                                                         result, &error);
        if (error) {
+               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                       goto out;
                g_warning ("Could not query directory contents: %s\n", error->message);
-               g_error_free (error);
-       } else if (cursor) {
+       }
+
+       notifier = user_data;
+
+       if (cursor) {
                sparql_contents_check_deleted (notifier, cursor);
                g_object_unref (cursor);
        }
 
        finish_current_directory (notifier, FALSE);
+
+out:
+       if (error) {
+               g_error_free (error);
+       }
 }
 
 static gchar *
@@ -745,15 +753,18 @@ sparql_files_query_cb (GObject      *object,
        TrackerSparqlCursor *cursor;
        GError *error = NULL;
 
-       notifier = data->notifier;
-       priv = notifier->priv;
-
        cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
                                                         result, &error);
        if (error) {
+               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                       goto out;
                g_warning ("Could not query indexed files: %s\n", error->message);
-               g_error_free (error);
-       } else if (cursor) {
+       }
+
+       notifier = data->notifier;
+       priv = notifier->priv;
+
+       if (cursor) {
                sparql_files_query_populate (notifier, cursor, TRUE);
                g_object_unref (cursor);
        }
@@ -771,6 +782,10 @@ sparql_files_query_cb (GObject      *object,
                finish_current_directory (notifier, FALSE);
        }
 
+out:
+       if (error) {
+               g_error_free (error);
+       }
        g_free (data);
 }
 


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