diff options
author | Robert Griebl <[email protected]> | 2015-04-15 13:57:51 +0200 |
---|---|---|
committer | Robert Griebl <[email protected]> | 2015-04-23 15:00:46 +0000 |
commit | 92433623b31388e2e8c4d532033dad6189eaab24 (patch) | |
tree | 1a20685ae0f7e5d3137ca001c2c222ae16aaf241 /src/quick/items/qquickshadereffectnode_p.h | |
parent | 3fdec636980c23b14cfc6aa74bc48bbb960ba0b4 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/quick/items/qquickshadereffectnode_p.h')
-rw-r--r-- | src/quick/items/qquickshadereffectnode_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h index 7e3cf74276..28382c483c 100644 --- a/src/quick/items/qquickshadereffectnode_p.h +++ b/src/quick/items/qquickshadereffectnode_p.h @@ -101,6 +101,8 @@ public: void updateTextures() const; void invalidateTextureProvider(QSGTextureProvider *provider); + static void cleanupMaterialCache(); + protected: friend class QQuickCustomMaterialShader; @@ -115,8 +117,6 @@ protected: QQuickShaderEffectNode *m_node; bool m_emittedLogChanged; - - static QHash<QQuickShaderEffectMaterialKey, QSharedPointer<QSGMaterialType> > materialMap; }; |