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
Pick-to: 6.5 6.4 6.2
Change-Id: I58902e1a33c0d3d101e39af3e5f0a18d6820ce98
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Andy Nichols 2023-03-14 14:33:47 +01:00 committed by Andy Nichols
parent 354e727c40
commit f1b188df13
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();
}