From 92433623b31388e2e8c4d532033dad6189eaab24 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 15 Apr 2015 13:57:51 +0200 Subject: Fix a memory leak in the material shader cache. There were multiple problems in the implementation of the shader cache: 1) it was not thread-safe 2) nothing was ever removed from the hash 3) since the keys into the hash are the actual shader source code, problem #2 would lead to serious memory consumption over time Change-Id: I20d1fb2074932e23f89edddba12e68ab8adcbff0 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/qsgrenderloop.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/quick/scenegraph/qsgrenderloop.cpp') diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index ce3bf7d61d..b7a6475c23 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -52,6 +52,8 @@ #include #include +#include + #ifdef Q_OS_WIN # include #endif @@ -293,6 +295,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) if (Q_UNLIKELY(!current)) qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context"; + QQuickShaderEffectMaterial::cleanupMaterialCache(); + d->cleanupNodesOnShutdown(); if (m_windows.size() == 0) { rc->invalidate(); -- cgit v1.2.3