From 761bd1810d76156001908744c58e7cc46b41ee1c Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 14 Mar 2023 14:33:47 +0100 Subject: [PATCH] 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 (cherry picked from commit f1b188df132c42da62197055725e5f7eebcc4249) Reviewed-by: Qt Cherry-pick Bot --- .../adaptations/software/qsgsoftwarecontext.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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(); }