aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2023-03-14 14:33:47 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-15 18:33:15 +0000
commit8f30d2b399ae913e5eb8f67ce5d3f35aa6c8ce95 (patch)
tree2d8d44edb263a03663b092c27e1b9289660b5f2c
parenta958aaa89ae44cd42433c34e51b602711d4ecabd (diff)
Software Adaptation: Don't leak QSGRenderContext resources
Subclasses of QSGRenderContext are responsible for releasing the resource tracked by the render context on invalidate. I'm not sure the software context will ever have any other resources than QSGTextures, but it doesn't hurt to try and release everything anyway. Fixes: QTBUG-106968 Change-Id: I58902e1a33c0d3d101e39af3e5f0a18d6820ce98 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit f1b188df132c42da62197055725e5f7eebcc4249) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
index 4da188bbfe..0c0ee5e579 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp
@@ -107,6 +107,18 @@ void QSGSoftwareRenderContext::initializeIfNeeded()
void QSGSoftwareRenderContext::invalidate()
{
+ qDeleteAll(m_texturesToDelete);
+ m_texturesToDelete.clear();
+
+ qDeleteAll(m_textures);
+ m_textures.clear();
+
+ qDeleteAll(m_fontEnginesToClean);
+ m_fontEnginesToClean.clear();
+
+ qDeleteAll(m_glyphCaches);
+ m_glyphCaches.clear();
+
m_sg->renderContextInvalidated(this);
emit invalidated();
}