From 41c00e87d42580881d8c7001f39014814e3b55f2 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Thu, 2 Feb 2012 04:11:56 +0100 Subject: Don't leak textures all over the place --- src/mesh.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesh.cpp') diff --git a/src/mesh.cpp b/src/mesh.cpp index 0f075f72b..b9ec82e18 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -433,6 +433,9 @@ video::ITexture *generateTextureFromMesh(scene::IMesh *mesh, } // Create render target texture + video::ITexture *oldtexture = driver->findTexture(texture_name.c_str()); + if(oldtexture) + driver->removeTexture(oldtexture); video::ITexture *rtt = driver->addRenderTargetTexture( dim, texture_name.c_str(), video::ECF_A8R8G8B8); if(rtt == NULL) -- cgit v1.2.3