summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-08-14 20:02:40 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-08-15 11:54:12 +0200
commit2ea876b353a314978a37cafc4db865549022b331 (patch)
tree81468ce03891b75036d759fdb65185120361fb26
parent44eb4d4da8b60fd15b81f8ec00b53051e7ada6cb (diff)
downloadtracker-2ea876b353a314978a37cafc4db865549022b331.tar.gz
libtracker-miner: Ensure TrackerFileNotifier stops on crawler interruption
finish_current_directory() shouldn't jump to the next directory in the current root if crawling is being interrupted there. Now that we unset priv->current_index_root as a result of interruption, we can avoid doing that ad-hoc on indexing_tree_directory_removed().
-rw-r--r--src/libtracker-miner/tracker-file-notifier.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 49a0998f5..50105aa1f 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -614,7 +614,8 @@ crawl_directory_in_current_root (TrackerFileNotifier *notifier)
}
static void
-finish_current_directory (TrackerFileNotifier *notifier)
+finish_current_directory (TrackerFileNotifier *notifier,
+ gboolean interrupted)
{
TrackerFileNotifierPrivate *priv;
GFile *directory;
@@ -629,7 +630,7 @@ finish_current_directory (TrackerFileNotifier *notifier)
directory,
G_FILE_TYPE_REGULAR);
- if (!crawl_directory_in_current_root (notifier)) {
+ if (interrupted || !crawl_directory_in_current_root (notifier)) {
/* No more directories left to be crawled in the current
* root, jump to the next one.
*/
@@ -652,7 +653,8 @@ finish_current_directory (TrackerFileNotifier *notifier)
root_data_free (priv->current_index_root);
priv->current_index_root = NULL;
- notifier_check_next_root (notifier);
+ if (!interrupted)
+ notifier_check_next_root (notifier);
}
g_object_unref (directory);
@@ -680,7 +682,7 @@ sparql_contents_query_cb (GObject *object,
g_object_unref (cursor);
}
- finish_current_directory (notifier);
+ finish_current_directory (notifier, FALSE);
}
static gchar *
@@ -766,7 +768,7 @@ sparql_files_query_cb (GObject *object,
priv->current_index_root->pending_dirs);
g_ptr_array_set_size (priv->current_index_root->updated_dirs, 0);
} else {
- finish_current_directory (notifier);
+ finish_current_directory (notifier, FALSE);
}
g_free (data);
@@ -892,7 +894,7 @@ crawler_finished_cb (TrackerCrawler *crawler,
g_assert (priv->current_index_root != NULL);
if (was_interrupted) {
- finish_current_directory (notifier);
+ finish_current_directory (notifier, TRUE);
return;
}
@@ -910,7 +912,7 @@ crawler_finished_cb (TrackerCrawler *crawler,
g_ptr_array_set_size (priv->current_index_root->query_files, 0);
} else {
file_notifier_traverse_tree (notifier, max_depth);
- finish_current_directory (notifier);
+ finish_current_directory (notifier, FALSE);
}
}
@@ -1361,9 +1363,6 @@ indexing_tree_directory_removed (TrackerIndexingTree *indexing_tree,
tracker_crawler_stop (priv->crawler);
g_cancellable_cancel (priv->cancellable);
- root_data_free (priv->current_index_root);
- priv->current_index_root = NULL;
-
notifier_check_next_root (notifier);
}