[clutter/clutter-1.12] actor: Release a reference on the implicit Transitions



commit 8e5c03d85839f0b3924aa70e255b86173159a860
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 4 22:43:22 2013 +0000

    actor: Release a reference on the implicit Transitions
    
    When stopping the transition we need to release the reference we
    maintain while removing the Transition from the hash table inside an
    actor. If we fail to do so, the Transition is never released, which
    means we leak the Animatable instance we tied to it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695158

 clutter/clutter-actor.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 404776d..be6ca9b 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -18470,7 +18470,9 @@ transition_closure_free (gpointer data)
       if (clutter_timeline_is_playing (timeline))
         clutter_timeline_stop (timeline);
 
+      /* remove the reference added in add_transition_internal() */
       g_object_unref (clos->transition);
+
       g_free (clos->name);
 
       g_slice_free (TransitionClosure, clos);
@@ -18502,9 +18504,7 @@ on_transition_stopped (ClutterTransition *transition,
     {
       /* we take a reference here because removing the closure
        * will release the reference on the transition, and we
-       * want the transition to survive the signal emission;
-       * the master clock will release the last reference at
-       * the end of the frame processing.
+       * want the transition to survive the signal emission
        */
       g_object_ref (transition);
 
@@ -18512,6 +18512,9 @@ on_transition_stopped (ClutterTransition *transition,
        * so we won't recurse
        */
       g_hash_table_remove (info->transitions, clos->name);
+
+      /* we can release the reference here */
+      g_object_unref (transition);
     }
 
   /* we emit the ::transition-stopped after removing the


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