From 14b9cb4f7b68b6c3798760309b5bb436c4e9d187 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 11 Apr 2012 13:57:06 +0100 Subject: [PATCH] actor: Fix completed transitions logic We need to remove the transition only if the current repeat is equal to the number of repeats, and if the transition was marked as remove on complete. Otherwise, the transition has to remain where it is. --- clutter/clutter-actor.c | 43 ++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 8170bf117..2e9385400 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -17052,41 +17052,32 @@ static void on_transition_completed (ClutterTransition *transition, TransitionClosure *clos) { + ClutterTimeline *timeline = CLUTTER_TIMELINE (transition); ClutterActor *actor = clos->actor; ClutterAnimationInfo *info; + gint n_repeats, cur_repeat; + + info = _clutter_actor_get_animation_info (actor); /* reset the caches used by animations */ clutter_actor_store_content_box (actor, NULL); - info = _clutter_actor_get_animation_info (actor); + /* ensure that we remove the transition only at the end + * of its run; we emit ::completed for every repeat + */ + n_repeats = clutter_timeline_get_repeat_count (timeline); + cur_repeat = clutter_timeline_get_current_repeat (timeline); - /* this will take care of cleaning clos for us */ - if (!clutter_transition_get_remove_on_complete (transition)) + if (cur_repeat == n_repeats) { - /* 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 laste reference at - * the end of the frame processing. - */ - g_object_ref (transition); - g_hash_table_remove (info->transitions, clos->name); - } - else - { - ClutterTimeline *timeline = CLUTTER_TIMELINE (transition); - gint n_repeats, cur_repeat; - - /* ensure that we remove the transition only at the end - * of its run; we emit ::completed for every repeat - */ - - n_repeats = clutter_timeline_get_repeat_count (timeline); - cur_repeat = clutter_timeline_get_current_repeat (timeline); - - if (cur_repeat == n_repeats) + if (clutter_transition_get_remove_on_complete (transition)) { - /* see the comment above on why this ref() is necessary */ + /* 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. + */ g_object_ref (transition); g_hash_table_remove (info->transitions, clos->name); }