summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsslideplayer_p.h
diff options
context:
space:
mode:
authorAdam Treat <adam.treat@qt.io>2018-03-06 11:41:27 -0500
committerAdam Treat <adam.treat@qt.io>2018-03-08 14:06:14 +0000
commit939c6c3f5664ddbb7062ee2ad5f84b6b65006bab (patch)
tree61c32629f5af754d7e5ccd1968452863650146a9 /src/runtime/q3dsslideplayer_p.h
parent613fa1e4df4e7d60484f05bc66580cecdd12f966 (diff)
Fix potential crash on application exit
A previous commit changed the object ownership of the AnimationManager class. The change did not result in a crash on exit, but that was by luck. The animation manager is a shared class between the slideplayer and its children. If the parent slideplayer deletes the animation manager and the children are then destructed it could cause a crash on exit in the future. This patch fixes it by sharing ownership of the AM by all slideplayers. Change-Id: Id9ae6b0459d035efc83b66befde089d0728cf19b Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/runtime/q3dsslideplayer_p.h')
-rw-r--r--src/runtime/q3dsslideplayer_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/q3dsslideplayer_p.h b/src/runtime/q3dsslideplayer_p.h
index ba22538..60167c2 100644
--- a/src/runtime/q3dsslideplayer_p.h
+++ b/src/runtime/q3dsslideplayer_p.h
@@ -94,7 +94,7 @@ public:
~Q3DSSlidePlayer();
Q3DSSlideDeck *slideDeck() const;
- Q3DSAnimationManager *animationManager() const { return m_animationManager; }
+ void advanceFrame();
float duration() const;
float position() const;
@@ -122,7 +122,7 @@ Q_SIGNALS:
void slideChanged(Q3DSSlide *);
private:
- Q3DSSlidePlayer(Q3DSAnimationManager *animationManager,
+ Q3DSSlidePlayer(QSharedPointer<Q3DSAnimationManager> animationManager,
Q3DSSceneManager *sceneManager,
Q3DSComponentNode *component,
QObject *parent = nullptr);
@@ -152,7 +152,7 @@ private:
Q3DSSceneManager *m_sceneManager;
Q3DSComponentNode *m_component = nullptr;
- Q3DSAnimationManager *m_animationManager;
+ QSharedPointer<Q3DSAnimationManager> m_animationManager;
PlayerMode m_mode = PlayerMode::Viewer;
PlayerType m_type = PlayerType::Slide;
};