aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-02-27 15:17:35 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-03-06 08:50:49 +0000
commit05a88efb266ec3b7b16d6db0d971c21ae7f45c9d (patch)
treee246851b3ee61327441c4e12f6fb7a99ef73fa0c /src/quick/util
parent201d9f1c62516542d4558f0d2b07542e1082b497 (diff)
QQuickAnimatorProxyJob: make sure to stop when detached from a window
Qt Quick Controls 2 StackView auto tests exposed an issue that animator proxy jobs keep ticking after being unassociated from a window. Change-Id: Ib9b3a0e02ac4cc3f3e98ddf05c8b01f0bbd614d3 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'src/quick/util')
-rw-r--r--src/quick/util/qquickanimatorjob.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index 4aacb09c97..dced8b49a9 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -140,6 +140,11 @@ QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a
void QQuickAnimatorProxyJob::updateCurrentTime(int)
{
+ // A proxy which is being ticked should be associated with a window, (see
+ // setWindow() below). If we get here when there is no more controller we
+ // have a problem.
+ Q_ASSERT(m_controller);
+
// We do a simple check here to see if the animator has run and stopped on
// the render thread. isPendingStart() will perform a check against jobs
// that have been scheduled for start, but that will not yet have entered
@@ -167,9 +172,9 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState,
}
} else if (newState == Stopped) {
- syncBackCurrentValues();
m_internalState = State_Stopped;
if (m_controller) {
+ syncBackCurrentValues();
m_controller->cancel(m_job);
}
}
@@ -193,6 +198,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window)
if (m_job && m_controller)
m_controller->cancel(m_job);
m_controller = nullptr;
+ stop();
} else if (!m_controller && m_job) {
m_controller = QQuickWindowPrivate::get(window)->animationController;