[grilo-plugins] metadata-store: set finalize function to clean up
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] metadata-store: set finalize function to clean up
- Date: Thu, 2 Mar 2017 12:27:49 +0000 (UTC)
commit 475044bb54e36b5f91d657423a3da7934ad71423
Author: Victor Toso <me victortoso com>
Date: Wed Mar 1 22:36:45 2017 +0100
metadata-store: set finalize function to clean up
514,040 (80 direct, 513,960 indirect) bytes in 1 blocks are definitely lost in loss record 19,311 of
19,314
at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
by 0x222277D6: sqlite3MemMalloc (sqlite3.c:20398)
by 0x22202967: mallocWithAlarm (sqlite3.c:24067)
by 0x22202967: sqlite3Malloc (sqlite3.c:24098)
by 0x22202A0D: sqlite3MallocZero (sqlite3.c:24398)
by 0x222499F5: sqlite3BtreeOpen (sqlite3.c:60320)
by 0x22297786: openDatabase (sqlite3.c:139437)
by 0x2662D0B0: grl_metadata_store_source_init (grl-metadata-store.c:237)
by 0x53C07FA: g_type_create_instance (gtype.c:1866)
by 0x53A269A: g_object_new_internal (gobject.c:1783)
by 0x53A45AD: g_object_new_valist (gobject.c:2042)
by 0x53A4850: g_object_new (gobject.c:1626)
by 0x2662CF9E: grl_metadata_store_source_new (grl-metadata-store.c:194)
by 0x2662CF9E: grl_metadata_store_source_plugin_init (grl-metadata-store.c:167)
https://bugzilla.gnome.org/show_bug.cgi?id=779444
src/metadata-store/grl-metadata-store.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/metadata-store/grl-metadata-store.c b/src/metadata-store/grl-metadata-store.c
index 1e107a2..cab80b8 100644
--- a/src/metadata-store/grl-metadata-store.c
+++ b/src/metadata-store/grl-metadata-store.c
@@ -121,6 +121,8 @@ enum {
MEDIA_CONTAINER
};
+static void grl_metadata_store_source_class_finalize (GObject *object);
+
static GrlMetadataStoreSource *grl_metadata_store_source_new (void);
static void grl_metadata_store_source_resolve (GrlSource *source,
@@ -148,6 +150,7 @@ gboolean grl_metadata_store_source_plugin_init (GrlRegistry *registry,
GrlPlugin *plugin,
GList *configs);
+G_DEFINE_TYPE (GrlMetadataStoreSource, grl_metadata_store_source, GRL_TYPE_SOURCE);
/* =================== GrlMetadataStore Plugin =============== */
@@ -201,8 +204,11 @@ grl_metadata_store_source_new (void)
static void
grl_metadata_store_source_class_init (GrlMetadataStoreSourceClass * klass)
{
+ GObjectClass *g_class = G_OBJECT_CLASS (klass);
GrlSourceClass *source_class = GRL_SOURCE_CLASS (klass);
+ g_class->finalize = grl_metadata_store_source_class_finalize;
+
source_class->supported_keys = grl_metadata_store_source_supported_keys;
source_class->writable_keys = grl_metadata_store_source_writable_keys;
source_class->get_caps = grl_metadata_store_source_get_caps;
@@ -215,6 +221,16 @@ grl_metadata_store_source_class_init (GrlMetadataStoreSourceClass * klass)
}
static void
+grl_metadata_store_source_class_finalize (GObject *object)
+{
+ GrlMetadataStoreSource *source = GRL_METADATA_STORE_SOURCE (object);
+
+ sqlite3_close (source->priv->db);
+
+ G_OBJECT_CLASS (grl_metadata_store_source_parent_class)->finalize (object);
+}
+
+static void
grl_metadata_store_source_init (GrlMetadataStoreSource *source)
{
gint r;
@@ -274,10 +290,6 @@ grl_metadata_store_source_init (GrlMetadataStoreSource *source)
GRL_DEBUG (" OK");
}
-G_DEFINE_TYPE (GrlMetadataStoreSource,
- grl_metadata_store_source,
- GRL_TYPE_SOURCE);
-
/* ======================= Utilities ==================== */
static sqlite3_stmt *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]