[tracker/wip/passive-extraction] extract: Ensure a task is added to priv->running_tasks just once
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/passive-extraction] extract: Ensure a task is added to priv->running_tasks just once
- Date: Mon, 20 Jan 2014 19:20:24 +0000 (UTC)
commit 8ed1b221eb87160a0956556283872a81c6460410
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jan 20 20:08:20 2014 +0100
extract: Ensure a task is added to priv->running_tasks just once
If a tasks was iterated over multiple extraction modules, the task
ended up inserted on priv->running_tasks more than once, but only
removed once when the task finished, leaving dangling pointers in
priv->running_tasks.
src/tracker-extract/tracker-extract.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 2f06924..25d5f9b 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -663,10 +663,6 @@ dispatch_task_cb (TrackerExtractTask *task)
return FALSE;
}
- g_mutex_lock (&priv->task_mutex);
- priv->running_tasks = g_list_prepend (priv->running_tasks, task);
- g_mutex_unlock (&priv->task_mutex);
-
switch (thread_awareness) {
case TRACKER_MODULE_NONE:
/* Error out */
@@ -769,6 +765,14 @@ tracker_extract_file (TrackerExtract *extract,
g_simple_async_result_complete_in_idle (res);
g_error_free (error);
} else {
+ TrackerExtractPrivate *priv;
+
+ priv = TRACKER_EXTRACT_GET_PRIVATE (task->extract);
+
+ g_mutex_lock (&priv->task_mutex);
+ priv->running_tasks = g_list_prepend (priv->running_tasks, task);
+ g_mutex_unlock (&priv->task_mutex);
+
g_idle_add ((GSourceFunc) dispatch_task_cb, task);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]