diff options
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
| -rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index e9e6c26d88..f10dbd4bc6 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -322,6 +322,8 @@ QSGTextMaskMaterial::QSGTextMaskMaterial(QSGRenderContext *rc, const QVector4D & QSGTextMaskMaterial::~QSGTextMaskMaterial() { + if (m_retainedFontEngine != nullptr) + m_rc->unregisterFontengineForCleanup(m_retainedFontEngine); delete m_texture; } @@ -385,6 +387,12 @@ void QSGTextMaskMaterial::updateCache(QFontEngine::GlyphFormat glyphFormat) if (!m_glyphCache || int(m_glyphCache->glyphFormat()) != glyphFormat) { m_glyphCache = new QSGRhiTextureGlyphCache(m_rc, glyphFormat, glyphCacheTransform, color); fontEngine->setGlyphCache(cacheKey, m_glyphCache.data()); + if (m_retainedFontEngine != nullptr) + m_rc->unregisterFontengineForCleanup(m_retainedFontEngine); + + // Note: This is reference counted by the render context, so it will stay alive until + // we release that reference + m_retainedFontEngine = fontEngine; m_rc->registerFontengineForCleanup(fontEngine); } } |
