[cheese] Add a finalize method to CheeseEffect



commit a6eeda8d44d9b58d1828d172bad77edcf46d98f0
Author: David King <amigadave amigadave com>
Date:   Fri Nov 15 14:58:54 2013 +0000

    Add a finalize method to CheeseEffect
    
    The data in CheeseEffectPrivate was not being freed, leading to memory
    leaks.

 libcheese/cheese-effect.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-effect.c b/libcheese/cheese-effect.c
index 2c795ef..a6320e6 100644
--- a/libcheese/cheese-effect.c
+++ b/libcheese/cheese-effect.c
@@ -104,6 +104,22 @@ cheese_effect_set_property (GObject *object, guint property_id,
 }
 
 static void
+cheese_effect_finalize (GObject *object)
+{
+    CheeseEffect *effect;
+    CheeseEffectPrivate *priv;
+
+    effect = CHEESE_EFFECT (object);
+    priv = effect->priv;
+
+    g_clear_pointer (&priv->name, g_free);
+    g_clear_pointer (&priv->pipeline_desc, g_free);
+    g_clear_pointer (&priv->control_valve, gst_object_unref);
+
+    G_OBJECT_CLASS (cheese_effect_parent_class)->finalize (object);
+}
+
+static void
 cheese_effect_class_init (CheeseEffectClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -112,6 +128,7 @@ cheese_effect_class_init (CheeseEffectClass *klass)
 
   object_class->get_property = cheese_effect_get_property;
   object_class->set_property = cheese_effect_set_property;
+  object_class->finalize = cheese_effect_finalize;
 
   /**
    * CheeseEffect:name:


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