[tracker/writeback-refactor-rebase: 47/65] libtracker-miner: Ensure writeback operations are cancelled on unmounted volumes



commit d86541dd81497a3ca5d0e06259cec5b384225a2f
Author: Carlos Garnacho <carlos lanedo com>
Date:   Tue Jul 26 15:26:47 2011 +0200

    libtracker-miner: Ensure writeback operations are cancelled on unmounted volumes

 src/libtracker-miner/tracker-miner-fs.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 0dc969f..56c5aa2 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4581,6 +4581,27 @@ task_pool_cancel_foreach (gpointer data,
 	}
 }
 
+static void
+writeback_pool_cancel_foreach (gpointer data,
+			       gpointer user_data)
+{
+	GFile *task_file, *file;
+	TrackerTask *task;
+
+	task = data;
+	file = user_data;
+	task_file = tracker_task_get_file (task);
+
+	if (!file ||
+	    g_file_equal (task_file, file) ||
+	    g_file_has_prefix (task_file, file)) {
+		ItemWritebackData *task_data;
+
+		task_data = tracker_task_get_data (task);
+		g_cancellable_cancel (task_data->cancellable);
+	}
+}
+
 /**
  * tracker_miner_fs_directory_remove:
  * @fs: a #TrackerMinerFS
@@ -4616,6 +4637,12 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
 
 	g_debug ("  Cancelled processing pool tasks at %f\n", g_timer_elapsed (timer, NULL));
 
+	tracker_task_pool_foreach (priv->writeback_pool,
+	                           writeback_pool_cancel_foreach,
+	                           file);
+	g_debug ("  Cancelled writeback pool tasks at %f\n",
+	         g_timer_elapsed (timer, NULL));
+
 	if (fs->priv->current_directory) {
 		GFile *current_file;
 



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