[grilo-plugins] opensubtitles: Add ::finalize implementation
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] opensubtitles: Add ::finalize implementation
- Date: Tue, 19 Sep 2017 10:39:03 +0000 (UTC)
commit 882086cbf6936e475acafdc804a3a6264c7ebdfb
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Sep 18 11:09:40 2017 +0200
opensubtitles: Add ::finalize implementation
The source has some private data to free when an instance goes away.
src/opensubtitles/grl-opensubtitles.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/opensubtitles/grl-opensubtitles.c b/src/opensubtitles/grl-opensubtitles.c
index 20b5584..a5f12d2 100644
--- a/src/opensubtitles/grl-opensubtitles.c
+++ b/src/opensubtitles/grl-opensubtitles.c
@@ -66,6 +66,7 @@ static GrlKeyID GRL_OPENSUBTITLES_METADATA_KEY_SUBTITLES_LANG = GRL_METADATA_KEY
/**/
static GrlOpenSubtitlesSource *grl_opensubtitles_source_new (void);
+static void grl_opensubtitles_source_finalize (GObject *object);
static void grl_opensubtitles_source_resolve (GrlSource *source,
GrlSourceResolveSpec *rs);
@@ -180,12 +181,15 @@ static void
grl_opensubtitles_source_class_init (GrlOpenSubtitlesSourceClass * klass)
{
GrlSourceClass *source_class = GRL_SOURCE_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
source_class->supported_keys = grl_opensubtitles_source_supported_keys;
source_class->cancel = grl_opensubtitles_source_cancel;
source_class->may_resolve = grl_opensubtitles_source_may_resolve;
source_class->resolve = grl_opensubtitles_source_resolve;
+ gobject_class->finalize = grl_opensubtitles_source_finalize;
+
g_type_class_add_private (klass, sizeof (GrlOpenSubtitlesSourcePriv));
}
@@ -202,6 +206,21 @@ G_DEFINE_TYPE (GrlOpenSubtitlesSource,
grl_opensubtitles_source,
GRL_TYPE_SOURCE);
+static void
+grl_opensubtitles_source_finalize (GObject *object)
+{
+ GrlOpenSubtitlesSource *source = GRL_OPENSUBTITLES_SOURCE (object);
+ GrlOpenSubtitlesSourcePriv *priv = GRL_OPENSUBTITLES_SOURCE_GET_PRIVATE (source);
+
+ GRL_DEBUG ("%s", G_STRFUNC);
+
+ g_clear_object (&priv->session);
+ g_async_queue_unref (priv->queue);
+
+ G_OBJECT_CLASS (grl_opensubtitles_source_parent_class)->finalize (object);
+}
+
+
/* ======================= Utilities ==================== */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]