summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index efe1fb092..617f4db85 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -200,8 +200,11 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event)
}
} else if (event->timerId() == animationTimer.timerId()) {
const int delta = lastTick - oldLastTick;
- for (int i = 0; i < animations.count(); ++i) {
- QAbstractAnimation *animation = animations.at(i);
+ //we copy the list so that if it is changed we still get to
+ //call setCurrentTime on all animations.
+ const QList<QAbstractAnimation*> currentAnimations = animations;
+ for (int i = 0; i < currentAnimations.count(); ++i) {
+ QAbstractAnimation *animation = currentAnimations.at(i);
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);