diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-03-13 16:33:18 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-03-15 14:23:25 +0000 |
commit | 212ccd59627deb8c06227dbf0f3f3329006c326e (patch) | |
tree | fec9b644ba056f542359c87b79dc72a3a91f6606 /src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | |
parent | 12e82111ab86669969430ab10118236d8d846d33 (diff) |
QSGDistanceFieldGlyphNode: Remove per-node QLinkedList of nodes to delete
We avoided deleting these nodes directly due to preprocess, but this is
a bit of a hack. QSGRenderer::preprocess already contains some work to
allow for modification of nodes at preprocess time, but it didn't allow
for detecting dead nodes.
By marking a pointer as not to be touched if it is removed during preprocess,
we can remove the per-node QLinkedList and delete directly, while at the same
time, still not touching deleted nodes later on in preprocess.
Change-Id: I99a1ea65d3fe0b73db73e4a1d10d999d56edcdc4
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'src/quick/scenegraph/qsgdistancefieldglyphnode.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index 456a197ba1..11c5444cd2 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -76,9 +76,6 @@ QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode() m_glyph_cache->unregisterGlyphNode(this); m_glyph_cache->unregisterOwnerElement(ownerElement()); } - - while (m_nodesToDelete.count()) - delete m_nodesToDelete.takeLast(); } void QSGDistanceFieldGlyphNode::setColor(const QColor &color) @@ -158,9 +155,6 @@ void QSGDistanceFieldGlyphNode::preprocess() { Q_ASSERT(m_glyph_cache); - while (m_nodesToDelete.count()) - delete m_nodesToDelete.takeLast(); - m_glyph_cache->processPendingGlyphs(); m_glyph_cache->update(); @@ -188,13 +182,12 @@ void QSGDistanceFieldGlyphNode::updateGeometry() // Remove previously created sub glyph nodes // We assume all the children are sub glyph nodes QSGNode *subnode = firstChild(); + QSGNode *nextNode = 0; while (subnode) { - // We can't delete the node now as it might be in the preprocess list - // It will be deleted in the next preprocess - m_nodesToDelete.append(subnode); - subnode = subnode->nextSibling(); + nextNode = subnode->nextSibling(); + delete subnode; + subnode = nextNode; } - removeAllChildNodes(); QSGGeometry *g = geometry(); |