From dd08a22a4e8d7120341a1227e227de3f0628dd2f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 16 Oct 2014 16:57:08 +0200 Subject: Invalidate font caches when switching between threads The font caches can only be used from a single thread at a time. QFontEngineFT for instance, uses a global static thread storage which is accessed on releasing and creating engines, and this causes a crash if the font engine is created on one thread and released on another. We use the updatePolish() function to make sure the caches are empty before entering updatePaintNode(), and then we invalidate the cache again after updatePaintNode() is done. [ChangeLog][Text] Fixed uncommon crash in text nodes. Change-Id: I01dbc2ed58aeebd03d77a157c700330334bdb385 Task-number: QTBUG-38800 Reviewed-by: Konstantin Ritt --- src/quick/items/qquicktextedit_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/quick/items/qquicktextedit_p.h') diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 54e6dd229a..5d1c026c5c 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -330,6 +330,7 @@ private Q_SLOTS: private: void markDirtyNodesForRange(int start, int end, int charDelta); void updateTotalLines(); + void invalidateFontCaches(); protected: virtual void geometryChanged(const QRectF &newGeometry, @@ -354,6 +355,7 @@ protected: void inputMethodEvent(QInputMethodEvent *e); #endif QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData); + void updatePolish(); friend class QQuickTextUtil; friend class QQuickTextDocument; -- cgit v1.2.3