aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnode.cpp
diff options
context:
space:
mode:
authoraavit <qt_aavit@ovi.com>2012-05-30 11:13:55 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-30 15:10:56 +0200
commita8c137f0e6eabb768f156134b06e022d44993ce2 (patch)
treeff9caea426a7e2d5f0edccb8a6950565fca9f8ce /src/quick/items/qquicktextnode.cpp
parent3beebd602b2d6074a745d797de64f04a13093456 (diff)
Avoid non-deterministic ordering of glyph nodes.
The ordering of glyph nodes depended on the internal ordering of a QHash, where the key contains the value of a heap pointer, so it could change with each run (even if QT_HASH_SEED was set). This made effective regression testing impossible. Change-Id: I1e5cff7db6d0db9ebbfb1e5b2e3d6e56170752b7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktextnode.cpp')
-rw-r--r--src/quick/items/qquicktextnode.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 597ebc47e0..db3c6279c2 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -966,6 +966,7 @@ namespace {
// font, selection state and clip node.
typedef QPair<QFontEngine *, QPair<QSGClipNode *, QPair<QRgb, int> > > KeyType;
QHash<KeyType, BinaryTreeNode *> map;
+ QList<BinaryTreeNode *> nodes;
for (int i=0; i<m_processedNodes.size(); ++i) {
BinaryTreeNode *node = m_processedNodes.data() + i;
@@ -999,6 +1000,7 @@ namespace {
} else {
map.insert(key, node);
+ nodes.append(node);
}
} else {
parentNode->addImage(node->boundingRect, node->image);
@@ -1011,10 +1013,7 @@ namespace {
}
// ...and add clip nodes and glyphs to tree.
- QHash<KeyType, BinaryTreeNode *>::const_iterator it = map.constBegin();
- while (it != map.constEnd()) {
-
- BinaryTreeNode *node = it.value();
+ foreach (const BinaryTreeNode *node, nodes) {
QSGClipNode *clipNode = node->clipNode;
if (clipNode != 0 && clipNode->parent() == 0 )
@@ -1025,8 +1024,6 @@ namespace {
: node->color;
parentNode->addGlyphs(node->position, node->glyphRun, color, style, styleColor, clipNode);
-
- ++it;
}
}
}