[grilo-plugins] vimeo: Don't leak cache directories
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] vimeo: Don't leak cache directories
- Date: Tue, 5 Nov 2013 08:09:51 +0000 (UTC)
commit a23a28414d65c8ae61e809d78c9960d0c32676bb
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 4 12:00:26 2013 +0100
vimeo: Don't leak cache directories
Temporary cache directories were never removed on exit because
an instance of GrlNetWc was never unref'ed because a GVimeo instance
was never unref'ed because GrlVimeoSource lacked a finalize method.
Add a finalize method to remove empty cache directories on exit.
https://bugzilla.gnome.org/show_bug.cgi?id=711393
src/vimeo/grl-vimeo.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index 8961d37..d3ecba2 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -79,6 +79,7 @@ struct _GrlVimeoSourcePrivate {
};
static GrlVimeoSource *grl_vimeo_source_new (void);
+static void grl_vimeo_source_finalize (GObject *object);
gboolean grl_vimeo_plugin_init (GrlRegistry *registry,
GrlPlugin *plugin,
@@ -192,12 +193,15 @@ static void
grl_vimeo_source_class_init (GrlVimeoSourceClass * klass)
{
GrlSourceClass *source_class = GRL_SOURCE_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
source_class->supported_keys = grl_vimeo_source_supported_keys;
source_class->slow_keys = grl_vimeo_source_slow_keys;
source_class->resolve = grl_vimeo_source_resolve;
source_class->search = grl_vimeo_source_search;
+ object_class->finalize = grl_vimeo_source_finalize;
+
g_type_class_add_private (klass, sizeof (GrlVimeoSourcePrivate));
}
@@ -211,6 +215,16 @@ grl_vimeo_source_init (GrlVimeoSource *source)
G_DEFINE_TYPE (GrlVimeoSource, grl_vimeo_source, GRL_TYPE_SOURCE);
+static void
+grl_vimeo_source_finalize (GObject *object)
+{
+ GrlVimeoSource *source = GRL_VIMEO_SOURCE (object);
+
+ g_clear_object (&source->priv->vimeo);
+
+ G_OBJECT_CLASS (grl_vimeo_source_parent_class)->finalize (object);
+}
+
/* ======================= Utilities ==================== */
static gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]