diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-02 09:17:39 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-03 10:53:26 +0100 |
| commit | 17fa564a94f98486ff41030c47629bd902c48e8d (patch) | |
| tree | 74d5619d37c8c47b092e40f035e72579de77cc09 /src/quick/util/qquickanimation.cpp | |
| parent | 0deb3961e6b0a1f15a491f7a19085df3a7a506b1 (diff) | |
Animations: Drop checks for duplicate jobs
We cannot return the same job multiple times from transition(). The
calling code takes ownership of the job, and even retaining a pointer to
it in the animation would be a problem. There are no animations that
return the same job multiple times, though.
Task-number: QTBUG-90401
Change-Id: I3a113c624a20dceee745cd6a4fca6f3634bdbdd1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick/util/qquickanimation.cpp')
| -rw-r--r-- | src/quick/util/qquickanimation.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index bfdc863d10..f2ee096af7 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -165,17 +165,15 @@ void QQuickAbstractAnimationPrivate::commence() QQuickStateActions actions; QQmlProperties properties; - QAbstractAnimationJob *oldInstance = animationInstance; - animationInstance = q->transition(actions, properties, QQuickAbstractAnimation::Forward); - if (oldInstance && oldInstance != animationInstance) - delete oldInstance; + auto *newInstance = q->transition(actions, properties, QQuickAbstractAnimation::Forward); + Q_ASSERT(newInstance != animationInstance); + delete animationInstance; + animationInstance = newInstance; if (animationInstance) { - if (oldInstance != animationInstance) { - if (q->threadingModel() == QQuickAbstractAnimation::RenderThread) - animationInstance = new QQuickAnimatorProxyJob(animationInstance, q); - animationInstance->addAnimationChangeListener(this, QAbstractAnimationJob::Completion); - } + if (q->threadingModel() == QQuickAbstractAnimation::RenderThread) + animationInstance = new QQuickAnimatorProxyJob(animationInstance, q); + animationInstance->addAnimationChangeListener(this, QAbstractAnimationJob::Completion); emit q->started(); animationInstance->start(); } |
