diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-16 11:32:33 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-03 18:05:14 +0000 |
commit | 0e30dc40df70cef2cd3f31b913bf867a620327cb (patch) | |
tree | 971afe01ee262838247feb4ca776016327e6587d /src/quick/items/qquickanimatedsprite_p.h | |
parent | 0e0c351fff752ceadc99eef5fbcf5a180f453efc (diff) |
AnimatedSprite: don't access deleted scene graph nodes
It’s a bad idea to store a scene graph paint node as a member variable.
First of all, it should not access the node outside updatePaintNode(),
that is, outside the render thread. Secondly, the node is owned by the
scene graph and may be nuked whenever the scene graph feels so. Some
creative re-parenting easily triggers a case where AnimatedSprite ends
up accessing a node that was already deleted by the scene graph.
Change-Id: I89205ac36333a2fcb094121afa61b6409fda5883
Task-number: QTBUG-51162
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquickanimatedsprite_p.h')
-rw-r--r-- | src/quick/items/qquickanimatedsprite_p.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index ffaddefb47..5b181640f9 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -351,19 +351,19 @@ public Q_SLOTS: private Q_SLOTS: void createEngine(); - void sizeVertices(); + void sizeVertices(QSGGeometryNode *node); -protected: +protected Q_SLOTS: void reset(); + +protected: void componentComplete() Q_DECL_OVERRIDE; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: bool isCurrentFrameChangedConnected(); - void prepareNextFrame(); + void prepareNextFrame(QSGGeometryNode *node); void reloadImage(); QSGGeometryNode* buildNode(); - QSGGeometryNode *m_node; - QQuickAnimatedSpriteMaterial *m_material; QQuickSprite* m_sprite; QQuickSpriteEngine* m_spriteEngine; QElapsedTimer m_timestamp; |