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 f1b188df13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Andy Nichols 2023-03-14 14:33:47 +01:00 committed by Qt Cherry-pick Bot
parent fff7e30de3
commit 761bd1810d
1 changed files with 12 additions and 0 deletions

View File

@ -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();
}