[clutter] interval: Do not leak the result GValue



commit bebe90e565f852ad858927fd0befe81137bf1326
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Jun 18 17:54:06 2012 +0100

    interval: Do not leak the result GValue
    
    The compute() method will cache the result, to avoid multiple
    allocations and copies; this means, though, that we need to unset the
    GValue when destroying the Interval.

 clutter/clutter-interval.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c
index 96d3122..1cbafda 100644
--- a/clutter/clutter-interval.c
+++ b/clutter/clutter-interval.c
@@ -399,8 +399,14 @@ clutter_interval_finalize (GObject *gobject)
 {
   ClutterIntervalPrivate *priv = CLUTTER_INTERVAL (gobject)->priv;
 
-  g_value_unset (&priv->values[0]);
-  g_value_unset (&priv->values[1]);
+  if (G_IS_VALUE (&priv->values[INITIAL]))
+    g_value_unset (&priv->values[INITIAL]);
+
+  if (G_IS_VALUE (&priv->values[FINAL]))
+    g_value_unset (&priv->values[FINAL]);
+
+  if (G_IS_VALUE (&priv->values[RESULT]))
+    g_value_unset (&priv->values[RESULT]);
 
   g_free (priv->values);
 



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