summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-01-08 13:48:47 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-01-08 16:34:36 +0000
commita8db9b8663f0bf3d66b36b5f743bd2fd47105cb6 (patch)
tree45366d2bea8dc58c02f7db2778af92e4ed470994 /src/gui/text/qtextengine.cpp
parentafb08ac5dae930912768f3f0ae4352189b8c3641 (diff)
Fix a crash in QTextEngine when a paragraph only contains a tab
This fixes a regression introduced by change c3d2d83fcb0f88de7d08cb7d088db8942e2e0f64. Change-Id: Idf840804c68cd6b1751e122b45e9dd2775af56f5 Fixes: QTBUG-72900 Fixes: QTBUG-72754 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r--src/gui/text/qtextengine.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index bdb5592e9e..506df0664d 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1972,14 +1972,18 @@ void QTextEngine::shape(int item) const
}
// fix log clusters to point to the previous glyph, as the object doesn't have a glyph of it's own.
// This is required so that all entries in the array get initialized and are ordered correctly.
- ushort *lc = logClusters(&li);
- *lc = item ? lc[-1] : 0;
+ if (layoutData->logClustersPtr) {
+ ushort *lc = logClusters(&li);
+ *lc = (lc != layoutData->logClustersPtr) ? lc[-1] : 0;
+ }
} else if (li.analysis.flags == QScriptAnalysis::Tab) {
// set up at least the ascent/descent/leading of the script item for the tab
fontEngine(li, &li.ascent, &li.descent, &li.leading);
// see the comment above
- ushort *lc = logClusters(&li);
- *lc = item ? lc[-1] : 0;
+ if (layoutData->logClustersPtr) {
+ ushort *lc = logClusters(&li);
+ *lc = (lc != layoutData->logClustersPtr) ? lc[-1] : 0;
+ }
} else {
shapeText(item);
}