Animations: Avoid accessing invalid memory if stop() triggers deletion
authorKai Koehne <kai.koehne@digia.com>
Tue, 28 May 2013 08:35:23 +0000 (10:35 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 29 May 2013 06:23:05 +0000 (08:23 +0200)
Return immediately if calling stop() results in the current object being
deleted.

Task-number: QTBUG-31247
Change-Id: I684a858bfb4cc53f415daa8cc1c4df96067daa1c
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
src/qml/animations/qsequentialanimationgroupjob.cpp

index c649370..b82e185 100644 (file)
@@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime)
         if (atEnd()) {
             //we make sure that we don't exceed the duration here
             m_currentTime += m_currentAnimation->currentTime() - newCurrentTime;
-            stop();
+            RETURN_IF_DELETED(stop());
         }
     } else {
         //the only case where currentAnimation could be null
         //is when all animations have been removed
         Q_ASSERT(!firstChild());
         m_currentTime = 0;
-        stop();
+        RETURN_IF_DELETED(stop());
     }
 
     m_previousLoop = m_currentLoop;