aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-09-22 14:06:05 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-22 08:23:18 +0200
commit9fde7c1723c316a4207ef28e12744c260c883071 (patch)
tree8d9025a6303cf7de7b00b160b8cc3b1e26768d86
parentf0dc82305eb9c9297d73cba67634e9e4bc4f3b84 (diff)
Stop managing lifetime of material
Let scenegraph handle it in its own thread. Task-number: QTBUG-21586 Change-Id: I5affcec4abbc79fff0c60e740d2c1cf04e3385f2 Reviewed-on: http://codereview.qt-project.org/5345 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index dd50ce2e83..872624ee51 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -667,7 +667,6 @@ QSGImageParticle::QSGImageParticle(QSGItem* parent)
QSGImageParticle::~QSGImageParticle()
{
- delete m_material;
}
QDeclarativeListProperty<QSGSprite> QSGImageParticle::sprites()
@@ -1106,10 +1105,8 @@ QSGGeometryNode* QSGImageParticle::buildParticleNodes()
}
clearShadows();
- if (m_material) {
- delete m_material;
+ if (m_material)
m_material = 0;
- }
//Setup material
QImage colortable;
@@ -1212,8 +1209,9 @@ QSGGeometryNode* QSGImageParticle::buildParticleNodes()
foreach (QSGGeometryNode* node, m_nodes){
if (node == *(m_nodes.begin()))
- continue;
- (*(m_nodes.begin()))->appendChildNode(node);
+ node->setFlag(QSGGeometryNode::OwnsMaterial);//Root node owns the material for memory management purposes
+ else
+ (*(m_nodes.begin()))->appendChildNode(node);
}
return *(m_nodes.begin());
@@ -1224,15 +1222,13 @@ QSGNode *QSGImageParticle::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
if (m_pleaseReset){
m_lastLevel = perfLevel;
- delete m_rootNode;//Automatically deletes children
+ delete m_rootNode;//Automatically deletes children, and SG manages material lifetime
m_rootNode = 0;
m_nodes.clear();
m_idxStarts.clear();
m_lastIdxStart = 0;
- if (m_material)
- delete m_material;
m_material = 0;
m_pleaseReset = false;