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); }