diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-14 13:14:33 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-14 13:55:43 (GMT) |
commit | 90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45 (patch) | |
tree | 0d821f9b05b990f7becb059e6b74968cf85dbc27 /src/gui | |
parent | 099f9a6c56fb82e5df188f401aa3619fec0722ff (diff) | |
download | Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.zip Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.tar.gz Qt-90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45.tar.bz2 |
Fix out of bounds handling in Mac shaper
After ensure space, local QGlyphLayout variable should be updated to
the moved address.
stringToCMap returns true for success, so stringToCMapFailed should
be the reverse of the return value.
Out of bounds happened quite often in all situations using the
QStackedTextEngine, because the memory allocated at the first time
is usually not much, making it easier to trigger out of bounds in
shaping. But it can also happen when using normal QTextLayout.
Test it by comparing the width returned by normal QTextLayout and
the width returned by QTextLayout created from QStackedTextEngine
via QFontMetricsF.
Task-number: QTBUG-16648
Reviewed-by: Eskil
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextengine_mac.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index ce42241..c34bdb3 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -604,8 +604,9 @@ void QTextEngine::shapeTextMac(int item) const bool stringToCMapFailed = false; if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { ensureSpace(num_glyphs); - stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, - attributes()); + g = availableGlyphs(&si); + stringToCMapFailed = !fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } if (!stringToCMapFailed) { |