transition: Check the repeat count to remove on complete
We can now ask the timeline for the current repeat, and if it's the last one, then we can safely detach the transition from the animatable instance.
This commit is contained in:
parent
388f818f41
commit
514466601e
@ -126,12 +126,19 @@ clutter_transition_completed (ClutterTimeline *timeline)
|
||||
{
|
||||
ClutterTransitionPrivate *priv = CLUTTER_TRANSITION (timeline)->priv;
|
||||
|
||||
if (priv->remove_on_complete &&
|
||||
clutter_timeline_get_repeat_count (timeline) != 0)
|
||||
if (priv->remove_on_complete)
|
||||
{
|
||||
clutter_transition_detach (CLUTTER_TRANSITION (timeline),
|
||||
priv->animatable);
|
||||
g_object_unref (timeline);
|
||||
int n_repeats, cur_repeat;
|
||||
|
||||
n_repeats = clutter_timeline_get_repeat_count (timeline);
|
||||
cur_repeat = clutter_timeline_get_current_repeat (timeline);
|
||||
|
||||
if (n_repeats == 0 || cur_repeat == n_repeats)
|
||||
{
|
||||
clutter_transition_detach (CLUTTER_TRANSITION (timeline),
|
||||
priv->animatable);
|
||||
g_object_unref (timeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user