From: sapier Date: Sun, 7 Apr 2013 19:42:54 +0000 (+0200) Subject: fix memory leak on shader shutdown X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=2bdff11d5472e4e5299c4e4e25e128b0869367a8;p=zefram%2Fminetest%2Fminetest_engine.git fix memory leak on shader shutdown --- diff --git a/src/shader.cpp b/src/shader.cpp index a224c82b..62b7c99a 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -388,6 +388,12 @@ ShaderSource::ShaderSource(IrrlichtDevice *device): ShaderSource::~ShaderSource() { //m_shader_callback->drop(); + + for (std::vector::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) diff --git a/src/shader.h b/src/shader.h index a7367eaf..a6256960 100644 --- a/src/shader.h +++ b/src/shader.h @@ -49,6 +49,7 @@ struct ShaderInfo video::E_MATERIAL_TYPE material; ShaderInfo(): name(""), material(video::EMT_SOLID) {} + virtual ~ShaderInfo() {} }; /*