summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-11-21 10:34:22 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2014-12-13 01:29:32 +0100
commit384388f2cd739fd1416e4016588c79fd9788e898 (patch)
treef05e0b3436ff129e18e300e54367dc3c1f2251eb /src/gui/text/qtextlayout.cpp
parent37490d465b203ac109f422b482eda9704f4e8593 (diff)
Make QRawFont usage safer in a multi-threaded environment
QFontEngine must be accessed amd deleted only in a thread in which it was instantiated, so we remember that thread and check if it hasn't been changed every time we access the engine. Change-Id: I28bc0394ced9cbd437dc950d35ffcbd99cfa7152 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 1ac50d3e5c..733bb57928 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2063,9 +2063,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
// Make a font for this particular engine
QRawFont font;
QRawFontPrivate *fontD = QRawFontPrivate::get(font);
- fontD->fontEngine = fontEngine;
- fontD->thread = QThread::currentThread();
- fontD->fontEngine->ref.ref();
+ fontD->setFontEngine(fontEngine);
+
QVarLengthArray<glyph_t> glyphsArray;
QVarLengthArray<QFixedPoint> positionsArray;