aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-03-31 19:59:00 +0000
committerkwolekr <kwolekr@minetest.net>2013-04-06 12:00:36 -0400
commitbecd8c03fd4c79422f2f829c6ec844888c80356c (patch)
treefffcbf8211162d2266c54fd9741e22238d94bc63
parent69367aa7998d3817db1d4b101f36a6e25b1becf8 (diff)
downloadminetest-becd8c03fd4c79422f2f829c6ec844888c80356c.tar.gz
minetest-becd8c03fd4c79422f2f829c6ec844888c80356c.tar.bz2
minetest-becd8c03fd4c79422f2f829c6ec844888c80356c.zip
fix memory leak
-rw-r--r--src/tile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tile.cpp b/src/tile.cpp
index aea9665f5..c5e8a2a9d 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -826,7 +826,7 @@ void TextureSource::rebuildImagesAndTextures()
video::ITexture *t = NULL;
if(img)
t = driver->addTexture(sap->name.c_str(), img);
-
+ video::ITexture *t_old = sap->a.atlas;
// Replace texture
sap->a.atlas = t;
sap->a.pos = v2f(0,0);
@@ -835,6 +835,9 @@ void TextureSource::rebuildImagesAndTextures()
sap->atlas_img = img;
sap->intpos = v2s32(0,0);
sap->intsize = img->getDimension();
+
+ if (t_old != 0)
+ driver->removeTexture(t_old);
}
}