diff options
author | Michael Brasser <michael.brasser@jollamobile.com> | 2014-03-12 10:44:28 -0500 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 16:39:34 +0100 |
commit | 11e9c49e5420bf749e4da48b1f14fa7dc9e4716f (patch) | |
tree | e98e44253850ec299f07dd8e7fb3d67165b02bad /src/qml/animations | |
parent | ef635d410dada5c8eaa963d127ccb53eae3194fb (diff) |
Don't crash if a ScriptAction changes state mid-transition.
Change-Id: Ia85cb128c7410e2276bf4da02f946d3d0bf44989
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/qml/animations')
-rw-r--r-- | src/qml/animations/qsequentialanimationgroupjob.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 41a83cefa2..ec9b2ba906 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -142,20 +142,21 @@ void QSequentialAnimationGroupJob::advanceForwards(const AnimationIndex &newAnim if (m_previousLoop < m_currentLoop) { // we need to fast forward to the end for (QAbstractAnimationJob *anim = m_currentAnimation; anim; anim = anim->nextSibling()) { - setCurrentAnimation(anim, true); + RETURN_IF_DELETED(setCurrentAnimation(anim, true)); RETURN_IF_DELETED(anim->setCurrentTime(animationActualTotalDuration(anim))); } // this will make sure the current animation is reset to the beginning - if (firstChild() && !firstChild()->nextSibling()) //count == 1 + if (firstChild() && !firstChild()->nextSibling()) { //count == 1 // we need to force activation because setCurrentAnimation will have no effect - activateCurrentAnimation(); - else - setCurrentAnimation(firstChild(), true); + RETURN_IF_DELETED(activateCurrentAnimation()); + } else { + RETURN_IF_DELETED(setCurrentAnimation(firstChild(), true)); + } } // and now we need to fast forward from the current position to for (QAbstractAnimationJob *anim = m_currentAnimation; anim && anim != newAnimationIndex.animation; anim = anim->nextSibling()) { //### WRONG, - setCurrentAnimation(anim, true); + RETURN_IF_DELETED(setCurrentAnimation(anim, true)); RETURN_IF_DELETED(anim->setCurrentTime(animationActualTotalDuration(anim))); } // setting the new current animation will happen later @@ -166,21 +167,21 @@ void QSequentialAnimationGroupJob::rewindForwards(const AnimationIndex &newAnima if (m_previousLoop > m_currentLoop) { // we need to fast rewind to the beginning for (QAbstractAnimationJob *anim = m_currentAnimation; anim; anim = anim->previousSibling()) { - setCurrentAnimation(anim, true); + RETURN_IF_DELETED(setCurrentAnimation(anim, true)); RETURN_IF_DELETED(anim->setCurrentTime(0)); } // this will make sure the current animation is reset to the end - if (lastChild() && !lastChild()->previousSibling()) //count == 1 + if (lastChild() && !lastChild()->previousSibling()) { //count == 1 // we need to force activation because setCurrentAnimation will have no effect - activateCurrentAnimation(); - else { - setCurrentAnimation(lastChild(), true); + RETURN_IF_DELETED(activateCurrentAnimation()); + } else { + RETURN_IF_DELETED(setCurrentAnimation(lastChild(), true)); } } // and now we need to fast rewind from the current position to for (QAbstractAnimationJob *anim = m_currentAnimation; anim && anim != newAnimationIndex.animation; anim = anim->previousSibling()) { - setCurrentAnimation(anim, true); + RETURN_IF_DELETED(setCurrentAnimation(anim, true)); RETURN_IF_DELETED(anim->setCurrentTime(0)); } // setting the new current animation will happen later @@ -220,7 +221,7 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) RETURN_IF_DELETED(rewindForwards(newAnimationIndex)); } - setCurrentAnimation(newAnimationIndex.animation); + RETURN_IF_DELETED(setCurrentAnimation(newAnimationIndex.animation)); const int newCurrentTime = currentTime - newAnimationIndex.timeOffset; @@ -310,7 +311,7 @@ void QSequentialAnimationGroupJob::activateCurrentAnimation(bool intermediate) if (m_currentAnimation->totalDuration() == -1) resetUncontrolledAnimationFinishTime(m_currentAnimation); - m_currentAnimation->start(); + RETURN_IF_DELETED(m_currentAnimation->start()); if (!intermediate && isPaused()) m_currentAnimation->pause(); } |