[tracker] libtracker-miner: Untangle SPARQL buffer task memory management
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Untangle SPARQL buffer task memory management
- Date: Wed, 12 Sep 2018 11:54:31 +0000 (UTC)
commit ff36b9129e813b1354286e51e2ec629dbe794ea6
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Sep 9 12:15:36 2018 +0200
libtracker-miner: Untangle SPARQL buffer task memory management
On one hand, the refcounting assignment was wrong, the task callback
is meant to receive a reference on the TrackerTask where it was
getting none.
On the other hand, after fixing it there is a circular reference
between the GTask and the TrackerTask that would prevent both to
be freed, break it by disposing the GTask as soon as it's dispatched.
src/libtracker-miner/tracker-sparql-buffer.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-sparql-buffer.c b/src/libtracker-miner/tracker-sparql-buffer.c
index ac52b3a92..899cbe0e2 100644
--- a/src/libtracker-miner/tracker-sparql-buffer.c
+++ b/src/libtracker-miner/tracker-sparql-buffer.c
@@ -276,9 +276,13 @@ tracker_sparql_buffer_update_array_cb (GObject *object,
g_task_return_error (task_data->async_task,
g_error_copy (error));
} else {
- g_task_return_pointer (task_data->async_task, task, NULL);
+ g_task_return_pointer (task_data->async_task,
+ tracker_task_ref (task),
+ (GDestroyNotify) tracker_task_unref);
}
+ g_clear_object (&task_data->async_task);
+
/* No need to deallocate the task here, it will be done when
* unref-ing the UpdateArrayData below */
}
@@ -382,9 +386,12 @@ tracker_sparql_buffer_update_cb (GObject *object,
g_task_return_error (task_data->async_task, error);
} else {
g_task_return_pointer (task_data->async_task,
- update_data->task, NULL);
+ tracker_task_ref (update_data->task),
+ (GDestroyNotify) tracker_task_unref);
}
+ g_clear_object (&task_data->async_task);
+
tracker_task_pool_remove (TRACKER_TASK_POOL (update_data->buffer),
update_data->task);
g_slice_free (UpdateData, update_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]