[tracker/miner-fs-refactor-multi-insert] libtracker-miner: Fix deallocation of tasks when stopping the miner



commit eca9e298d979572fde7f1427c02f0c93c0c987fa
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Mon Oct 18 12:53:28 2010 +0200

    libtracker-miner: Fix deallocation of tasks when stopping the miner

 .../tracker-miner-fs-processing-pool.c             |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.c b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
index 89a16f5..0caa713 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.c
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
@@ -216,7 +216,13 @@ static void
 pool_queue_free_foreach (gpointer data,
                          gpointer user_data)
 {
-	processing_task_free (data);
+	GPtrArray *sparql_buffer = user_data;
+
+	/* If found in the SPARQL buffer, remove it (will call task_free itself) */
+	if (!g_ptr_array_remove (sparql_buffer, data)) {
+		/* If not removed from the array, free it ourselves */
+		processing_task_free (data);
+	}
 }
 
 void
@@ -234,7 +240,7 @@ processing_pool_free (ProcessingPool *pool)
 	     i++) {
 		g_queue_foreach (pool->tasks[i],
 		                 pool_queue_free_foreach,
-		                 NULL);
+		                 pool->sparql_buffer);
 		g_queue_free (pool->tasks[i]);
 	}
 



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