[tracker/tracker-0.10] libtracker-miner: Ensure writeback operations are cancelled on unmounted volumes



commit 0d605f4bfd1c63584bdf99f4aec28ae0d610dded
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 9206706..1198914 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4624,6 +4624,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
@@ -4659,6 +4680,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]