aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2023-06-07 16:59:20 +0100
committerDavid Edmundson <[email protected]>2023-06-09 07:32:30 +0000
commitcc4fbbc5ef208ef22c94b1b034173edffacafe19 (patch)
tree63c5ecaf5712bbceb696cdfc8d3ee7f94f38ae44
parent01427bd0d9fc74794f6cfb22650aa5f7fdcbda76 (diff)
Match fontEngine glyph cache key to lifespan of owner
The glyph cache key is based on the RHI instance. We clean up the font cache when the QSGRenderContext is deleted. For a regular QQuickWindow this is effectively the same. For a QQuickWidget the RHI instance has a lifespan of the parent widget, but the render context changes. Task-number: QTBUG-113426 Task-number: QTBUG-112306 Pick-to: 6.6 6.5 Change-Id: Ifd901ace6caaff9a08352901956865f5f58e06ef Reviewed-by: Laszlo Agocs <[email protected]>
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp3
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 5c4fe767eb..e9e6c26d88 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -369,7 +369,8 @@ void QSGTextMaskMaterial::updateCache(QFontEngine::GlyphFormat glyphFormat)
qreal devicePixelRatio;
void *cacheKey;
Q_ASSERT(m_rhi);
- cacheKey = m_rhi;
+ Q_ASSERT(m_rc);
+ cacheKey = m_rc;
// Get the dpr the modern way. This value retrieved via the
// rendercontext matches what RenderState::devicePixelRatio()
// exposes to the material shaders later on.
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index cd0a5b6d28..462196927b 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -110,7 +110,7 @@ void QSGDefaultRenderContext::invalidate()
// sequence. (see qsgdefaultglyphnode_p.cpp's init())
for (QSet<QFontEngine *>::const_iterator it = m_fontEnginesToClean.constBegin(),
end = m_fontEnginesToClean.constEnd(); it != end; ++it) {
- (*it)->clearGlyphCache(m_rhi);
+ (*it)->clearGlyphCache(this);
if (!(*it)->ref.deref())
delete *it;
}