diff options
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 39d9832f58..bf92bf8b39 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -480,6 +480,12 @@ void QSGTextMaskMaterial::init(int cacheType) QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext()); Q_ASSERT(ctx != 0); + // The following piece of code will read/write to the font engine's caches, + // potentially from different threads. However, this is safe because this + // code is only called from QQuickItem::updatePaintNode() which is called + // only when the GUI is blocked, and multiple threads will call it in + // sequence. See also QSGRenderContext::invalidate + QRawFontPrivate *fontD = QRawFontPrivate::get(m_font); if (fontD->fontEngine != 0) { if (cacheType < 0) { @@ -494,6 +500,9 @@ void QSGTextMaskMaterial::init(int cacheType) m_glyphCache = new QOpenGLTextureGlyphCache(QFontEngineGlyphCache::Type(cacheType), QTransform()); fontD->fontEngine->setGlyphCache(ctx, m_glyphCache.data()); + QSGRenderContext *sg = QSGRenderContext::from(ctx); + Q_ASSERT(sg); + sg->registerFontengineForCleanup(fontD->fontEngine); } } } |