fix memory leak on shader shutdown
authorsapier <Sapier at GMX dot net>
Sun, 7 Apr 2013 19:42:54 +0000 (21:42 +0200)
committerkwolekr <kwolekr@minetest.net>
Mon, 8 Apr 2013 02:30:29 +0000 (22:30 -0400)
src/shader.cpp
src/shader.h

index a224c82bb271eda6053f0e57f382c618b4ff9772..62b7c99a936f71d0bd7081b6b3e852a4613e64a0 100644 (file)
@@ -388,6 +388,12 @@ ShaderSource::ShaderSource(IrrlichtDevice *device):
 ShaderSource::~ShaderSource()
 {
        //m_shader_callback->drop();
+
+       for (std::vector<IShaderConstantSetter*>::iterator iter = m_global_setters.begin();
+                       iter != m_global_setters.end(); iter++) {
+               delete *iter;
+       }
+       m_global_setters.clear();
 }
 
 u32 ShaderSource::getShaderId(const std::string &name)
index a7367eaff46a3895674382501bc8b32aaa16c46c..a62569602e1ac94dc3c329edda3a2be01841b05f 100644 (file)
@@ -49,6 +49,7 @@ struct ShaderInfo
        video::E_MATERIAL_TYPE material;
 
        ShaderInfo(): name(""), material(video::EMT_SOLID) {}
+       virtual ~ShaderInfo() {}
 };
 
 /*