aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-03-07 10:20:06 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-07 01:40:57 +0100
commit4b2a7b063bd8a75dd10859d477e53c833fc844fa (patch)
treef1839cee674803ea259210fba84994a5a13fafb7 /src
parent73ee7cb72e89ededacf90306f39110f1719e84c9 (diff)
Fix texture leaks in QQuickCanvasItem
In commit be4c74948371ddf6f1ed260783b43b5a3d9e60a7 we removed the QQuickCanvasItemNode, but textures are not automatically deleted with QSGSimpleTextureNode, so add a very thin sub class of QSGSimpleTextureNode to just cleanup canvas texture to avoid texture leaks. Change-Id: I31aac1068e8218a75129b52afbbf30fb66e4bbf7 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 3b4adc15ca..e2f57fe162 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -564,9 +564,16 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
if (!d->contextInitialized)
return 0;
- QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode*>(oldNode);
+ class CanvasTextureNode : public QSGSimpleTextureNode
+ {
+ public:
+ CanvasTextureNode() : QSGSimpleTextureNode() {}
+ ~CanvasTextureNode() {delete texture();}
+ };
+
+ CanvasTextureNode *node = static_cast<CanvasTextureNode*>(oldNode);
if (!node) {
- node = new QSGSimpleTextureNode;
+ node = new CanvasTextureNode;
}
if (d->renderStrategy == QQuickCanvasItem::Cooperative)