aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/animations
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-12-12 18:34:53 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-12-13 17:45:58 +0000
commit9929c250a3829aec82955da91413bc7673dc159d (patch)
treee4a14c9aebfbdfef1f647a4120bd6aa073998612 /src/qml/animations
parent39643ef86e8bc48b8b6cf83ac0ebae7411029030 (diff)
Animation: Avoid dangling pointers
When we clear a QSequentialAnimationGroupJob, we also need to clear its m_currentAnimation, as that always points to some animation job in its list. Change-Id: I1baae5121b00b5f65e84a7b5363704b6832ed386 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/animations')
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob_p.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index b01b2f3b36..a27c9195dd 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -72,7 +72,7 @@ public:
QAbstractAnimationJob *firstChild() const { return m_firstChild; }
QAbstractAnimationJob *lastChild() const { return m_lastChild; }
- void clear();
+ virtual void clear();
//called by QAbstractAnimationJob
virtual void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index 22e20d9268..0595141d60 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -204,6 +204,13 @@ int QSequentialAnimationGroupJob::duration() const
return ret;
}
+void QSequentialAnimationGroupJob::clear()
+{
+ m_currentAnimation = nullptr;
+ m_previousLoop = 0;
+ QAnimationGroupJob::clear();
+}
+
void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime)
{
if (!m_currentAnimation)
diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h
index 13f9806be1..34e8fe1e08 100644
--- a/src/qml/animations/qsequentialanimationgroupjob_p.h
+++ b/src/qml/animations/qsequentialanimationgroupjob_p.h
@@ -68,6 +68,7 @@ public:
int duration() const override;
QAbstractAnimationJob *currentAnimation() const { return m_currentAnimation; }
+ void clear() override;
protected:
void updateCurrentTime(int) override;