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



commit f3659d35a0fb7aac04cd30533a1acaf53f87a151
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 ef29e0e..b972939 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -18512,7 +18512,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);
@@ -18545,9 +18547,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);
 
@@ -18555,6 +18555,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]