[tracker/wip/carlosg/update-perf: 10/43] libtracker-data/core: Plug leaks on TrackerData updates object finalization
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 10/43] libtracker-data/core: Plug leaks on TrackerData updates object finalization
- Date: Wed, 24 Aug 2022 00:49:48 +0000 (UTC)
commit 7ca71149dcbbd4462c47540fbe743baa6ed46863
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jul 31 22:49:25 2022 +0200
libtracker-data/core: Plug leaks on TrackerData updates object finalization
And hook TrackerData finalization from TrackerDataManager dispose. As we want
to keep compiled statements around, we will want to properly finalize all
these before attempting to close the database interfaces.
src/libtracker-sparql/core/tracker-data-manager.c | 3 ++-
src/libtracker-sparql/core/tracker-data-update.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-manager.c
b/src/libtracker-sparql/core/tracker-data-manager.c
index 165b3f0df..714bbd554 100644
--- a/src/libtracker-sparql/core/tracker-data-manager.c
+++ b/src/libtracker-sparql/core/tracker-data-manager.c
@@ -4967,6 +4967,8 @@ tracker_data_manager_dispose (GObject *object)
GError *error = NULL;
gboolean readonly = TRUE;
+ g_clear_object (&manager->data_update);
+
if (manager->db_manager) {
readonly = (tracker_db_manager_get_flags (manager->db_manager, NULL, NULL) &
TRACKER_DB_MANAGER_READONLY) != 0;
@@ -4999,7 +5001,6 @@ tracker_data_manager_finalize (GObject *object)
TrackerDataManager *manager = TRACKER_DATA_MANAGER (object);
g_clear_object (&manager->ontologies);
- g_clear_object (&manager->data_update);
g_clear_pointer (&manager->graphs, g_hash_table_unref);
g_free (manager->status);
g_mutex_clear (&manager->connections_lock);
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index f1b5c7cf8..b52df89c0 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -484,6 +484,23 @@ tracker_data_get_property (GObject *object,
}
}
+static void
+tracker_data_finalize (GObject *object)
+{
+ TrackerData *data = TRACKER_DATA (object);
+
+ g_clear_pointer (&data->update_buffer.graphs, g_ptr_array_unref);
+ g_clear_pointer (&data->update_buffer.new_resources, g_hash_table_unref);
+ g_clear_pointer (&data->update_buffer.resource_cache, g_hash_table_unref);
+
+ g_clear_pointer (&data->insert_callbacks, g_ptr_array_unref);
+ g_clear_pointer (&data->delete_callbacks, g_ptr_array_unref);
+ g_clear_pointer (&data->commit_callbacks, g_ptr_array_unref);
+ g_clear_pointer (&data->rollback_callbacks, g_ptr_array_unref);
+
+ G_OBJECT_CLASS (tracker_data_parent_class)->finalize (object);
+}
+
static void
tracker_data_class_init (TrackerDataClass *klass)
{
@@ -491,6 +508,7 @@ tracker_data_class_init (TrackerDataClass *klass)
object_class->set_property = tracker_data_set_property;
object_class->get_property = tracker_data_get_property;
+ object_class->finalize = tracker_data_finalize;
g_object_class_install_property (object_class,
PROP_MANAGER,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]