diff options
Diffstat (limited to 'src/qml/animations')
-rw-r--r-- | src/qml/animations/qanimationgroupjob.cpp | 10 | ||||
-rw-r--r-- | src/qml/animations/qsequentialanimationgroupjob.cpp | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp index 344791fd83..66599561fc 100644 --- a/src/qml/animations/qanimationgroupjob.cpp +++ b/src/qml/animations/qanimationgroupjob.cpp @@ -120,13 +120,9 @@ void QAnimationGroupJob::removeAnimation(QAbstractAnimationJob *animation) void QAnimationGroupJob::clear() { - QAbstractAnimationJob *child = firstChild(); - QAbstractAnimationJob *nextSibling = nullptr; - while (child != nullptr) { - child->m_group = nullptr; - nextSibling = child->nextSibling(); - delete child; - child = nextSibling; + while (QAbstractAnimationJob *child = firstChild()) { + removeAnimation(child); + delete child; } m_firstChild = nullptr; m_lastChild = nullptr; diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 0595141d60..d98546122f 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -206,9 +206,11 @@ int QSequentialAnimationGroupJob::duration() const void QSequentialAnimationGroupJob::clear() { - m_currentAnimation = nullptr; m_previousLoop = 0; QAnimationGroupJob::clear(); + + // clear() should call removeAnimation(), which will clear m_currentAnimation, eventually. + Q_ASSERT(m_currentAnimation == nullptr); } void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) |