diff options
author | Bea Lam <bea.lam@nokia.com> | 2012-01-24 17:15:56 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-25 00:11:21 +0100 |
commit | 4c97a8091eff18cdff92d4fc5243a88bf57146d3 (patch) | |
tree | 5c395d9aa76f3cb2db1c84efba7fc07ec73b1e39 | |
parent | 0116fdd70a427dd9d5f1241c2de8cf77f7a5f134 (diff) |
Animations may be deleted while changing state
Move check for deleted animation from setCurrentTime() to setState().
Change-Id: I8160c4cf68f7e7b11185d3190d42e5c375540254
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
-rw-r--r-- | src/declarative/animations/qabstractanimationjob.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/declarative/animations/qabstractanimationjob.cpp b/src/declarative/animations/qabstractanimationjob.cpp index 067f791195..16680e1e07 100644 --- a/src/declarative/animations/qabstractanimationjob.cpp +++ b/src/declarative/animations/qabstractanimationjob.cpp @@ -321,7 +321,13 @@ void QAbstractAnimationJob::setState(QAbstractAnimationJob::State newState) if (newState == Running && oldState == Stopped && !m_group) topLevelAnimationLoopChanged(); + bool wasDeleted = false; + m_wasDeleted = &wasDeleted; updateState(newState, oldState); + if (wasDeleted) + return; + m_wasDeleted = 0; + if (newState != m_state) //this is to be safe if updateState changes the state return; @@ -432,12 +438,7 @@ void QAbstractAnimationJob::setCurrentTime(int msecs) if (m_currentLoop != oldLoop && !m_group) //### verify Running as well? topLevelAnimationLoopChanged(); - bool wasDeleted = false; - m_wasDeleted = &wasDeleted; updateCurrentTime(m_currentTime); - if (wasDeleted) - return; - m_wasDeleted = 0; if (m_currentLoop != oldLoop) currentLoopChanged(m_currentLoop); |