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/qquicktextinput_p.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/quick/items/qquicktextinput_p.h') diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 4b94530587..2386fc5642 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -314,6 +314,9 @@ Q_SIGNALS: #endif void renderTypeChanged(); +private: + void invalidateFontCaches(); + protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); @@ -332,6 +335,7 @@ protected: void focusInEvent(QFocusEvent *event); void timerEvent(QTimerEvent *event); QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data); + void updatePolish(); public Q_SLOTS: void selectAll(); -- cgit v1.2.3