Fix crash in QQuickCanvasItem::updatePaintNode()
authorTobias Koenig <tobias.koenig@kdab.com>
Tue, 11 Aug 2015 15:55:00 +0000 (17:55 +0200)
committerTobias Koenig <tobias.koenig@kdab.com>
Tue, 11 Aug 2015 16:02:06 +0000 (16:02 +0000)
QQuickCanvasItem manages the life time of the texture
already, so it shouldn't set the ownsTexture flag on the
QSGSimpleTextureNode, because that would result in a double deletion
when QSGSimpleTextureNode::setTexture() is called.

Change-Id: I7c1cc949b664d1a8b64bab092250439171e66233
Task-number: QTBUG-47714
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
src/quick/items/context2d/qquickcanvasitem.cpp

index cb694c499ae137087c64447c6634c27869ddcb27..75507c68d2ad3d7f993a2410118ff8fb8eb15afe 100644 (file)
@@ -57,7 +57,11 @@ class QQuickCanvasNode : public QSGSimpleTextureNode
 public:
     QQuickCanvasNode() {
         qsgnode_set_description(this, QStringLiteral("canvasnode"));
-        setOwnsTexture(true);
+        setOwnsTexture(false);
+    }
+
+    ~QQuickCanvasNode() {
+        delete texture();
     }
 };