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>
QSGImageParticle::~QSGImageParticle()
{
- delete m_material;
}
QDeclarativeListProperty<QSGSprite> QSGImageParticle::sprites()
}
clearShadows();
- if (m_material) {
- delete m_material;
+ if (m_material)
m_material = 0;
- }
//Setup material
QImage colortable;
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());
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;