summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-09-06 06:36:25 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-08 04:21:51 +0200
commit9ff76c27b9031ae7c49c4c9e8b5a3bea1e0e3c78 (patch)
treea191d74bf4d3e65e7aef7e0d5b8efad0ccc7944c /src
parent7b8f33fb78939a7564ce4d06cdbb6a13f00743ca (diff)
QTextEngine::shapeText(): Better error handling for corner cases
Use Q_UNREACHABLE() instead of silly return to catch shaping errors, which are fatal ones in fact, since the application would assert/crash some later due to a hard dependency on the shaping result. Change-Id: Ie58a2f2686a795f6178a588de6f2a2e37e1ed13c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 90f5ddbeba..275508db96 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -908,7 +908,7 @@ void QTextEngine::shapeText(int item) const
}
if (!ensureSpace(itemLength)) {
- // ### report OOM error somehow
+ Q_UNREACHABLE(); // ### report OOM error somehow
return;
}
@@ -934,12 +934,12 @@ void QTextEngine::shapeText(int item) const
if (!fontEngine->stringToCMap(reinterpret_cast<const QChar *>(string), itemLength, &initialGlyphs, &nGlyphs, shaperFlags)) {
nGlyphs = qMax(nGlyphs, itemLength); // ### needed for QFontEngine::stringToCMap() to not fail twice
if (!ensureSpace(nGlyphs)) {
- // ### report OOM error somehow
+ Q_UNREACHABLE(); // ### report OOM error somehow
return;
}
initialGlyphs = availableGlyphs(&si);
if (!fontEngine->stringToCMap(reinterpret_cast<const QChar *>(string), itemLength, &initialGlyphs, &nGlyphs, shaperFlags)) {
- // ### if this happens there is a bug in the fontengine
+ Q_UNREACHABLE(); // ### if this happens there is a bug in the fontengine
return;
}
}
@@ -987,7 +987,7 @@ void QTextEngine::shapeText(int item) const
si.num_glyphs = shapeTextWithHarfbuzz(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
if (si.num_glyphs == 0) {
- // ### report shaping errors somehow
+ Q_UNREACHABLE(); // ### report shaping errors somehow
return;
}