Fix a thread safety issue with QTextLine::glyphRuns

This is a very partial revert of 10ac80708.
Revert back to using engineFromScript, which is reentrant, for cases other
than the "rawfont mode". In that last case, reentrancy is not a big issue
so far as the only client is WebKit, and this is used in the web process,
with no threaded rendering.

Change-Id: I047b04cf0236d52e6d548f34cddd3dcc7c3c5f83
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Pierre Rossi 2012-04-16 13:36:18 +02:00 committed by Qt by Nokia
parent addffb71b4
commit 46556529ec

View File

@ -2288,7 +2288,13 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
iterator.getSelectionBounds(&x, &width);
if (glyphLayout.numGlyphs > 0) {
QFontEngine *mainFontEngine = eng->fontEngine(si);
QFontEngine *mainFontEngine;
#ifndef QT_NO_RAWFONT
if (eng->useRawFont && eng->rawFont.isValid())
mainFontEngine= eng->fontEngine(si);
else
#endif
mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);