[PATCH 6/7] [grl-media-plugin] Add finalize function to GrlMediaPlugin



---
 src/grl-media-plugin.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/grl-media-plugin.c b/src/grl-media-plugin.c
index 367d7f5..d954709 100644
--- a/src/grl-media-plugin.c
+++ b/src/grl-media-plugin.c
@@ -51,6 +51,8 @@ struct _GrlMediaPluginPrivate {
   const GrlPluginInfo *info;
 };
 
+static void grl_media_plugin_finalize (GObject *object);
+
 /* ================ GrlMediaPlugin GObject ================ */
 
 G_DEFINE_ABSTRACT_TYPE (GrlMediaPlugin, grl_media_plugin, G_TYPE_OBJECT);
@@ -58,6 +60,11 @@ G_DEFINE_ABSTRACT_TYPE (GrlMediaPlugin, grl_media_plugin, G_TYPE_OBJECT);
 static void
 grl_media_plugin_class_init (GrlMediaPluginClass *media_plugin_class)
 {
+  GObjectClass *gobject_class;
+  gobject_class = G_OBJECT_CLASS (media_plugin_class);
+
+  gobject_class->finalize = grl_media_plugin_finalize;
+
   g_type_class_add_private (media_plugin_class,
                             sizeof (GrlMediaPluginPrivate));
 }
@@ -68,6 +75,18 @@ grl_media_plugin_init (GrlMediaPlugin *plugin)
   plugin->priv = GRL_MEDIA_PLUGIN_GET_PRIVATE (plugin);
 }
 
+static void
+grl_media_plugin_finalize (GObject *object)
+{
+  GrlMediaPlugin *plugin = GRL_MEDIA_PLUGIN (object);
+
+  if (plugin->priv->info->optional_info) {
+    g_hash_table_destroy (plugin->priv->info->optional_info);
+  }
+
+  G_OBJECT_CLASS (grl_media_plugin_parent_class)->finalize (object);
+}
+
 /* ================ API ================ */
 
 void
-- 
1.7.0.4



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