diff options
author | Charles Yin <charles.yin@nokia.com> | 2012-05-09 16:01:51 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-17 06:44:33 +0200 |
commit | 8236ca1aedabccf4bda4d0e3873ace8b48c522d6 (patch) | |
tree | a56f6f5d7213ac069e41fce8ecaefd85b8f822f9 /src/qml/animations | |
parent | e4f8bfd303e84fcd6363d0c1974ce70944d1e9d9 (diff) |
More defense programming in animation code
1. Add more deletion checkings in animation job code
2. Add some more asserts
Change-Id: I34772792ea4638b61eb2c3d65da5d35ce75183d7
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/animations')
-rw-r--r-- | src/qml/animations/qabstractanimationjob.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index d1b8880087..285937db2a 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -284,8 +284,11 @@ QAbstractAnimationJob::~QAbstractAnimationJob() State oldState = m_state; m_state = Stopped; stateChanged(oldState, m_state); + + Q_ASSERT(m_state == Stopped); if (oldState == Running) QQmlAnimationTimer::unregisterAnimation(this); + Q_ASSERT(!m_hasRegisteredTimer); } if (m_group) @@ -337,7 +340,7 @@ void QAbstractAnimationJob::setState(QAbstractAnimationJob::State newState) return; // Notify state change - stateChanged(newState, oldState); + RETURN_IF_DELETED(stateChanged(newState, oldState)); if (newState != m_state) //this is to be safe if updateState changes the state return; @@ -351,7 +354,7 @@ void QAbstractAnimationJob::setState(QAbstractAnimationJob::State newState) if (isTopLevel) { // currentTime needs to be updated if pauseTimer is active QQmlAnimationTimer::ensureTimerUpdate(); - setCurrentTime(m_totalCurrentTime); + RETURN_IF_DELETED(setCurrentTime(m_totalCurrentTime)); } } } |