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>
This commit is contained in:
parent
7b8f33fb78
commit
9ff76c27b9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user