mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
fix memory leak
This commit is contained in:
parent
69367aa799
commit
becd8c03fd
1 changed files with 4 additions and 1 deletions
|
@ -826,7 +826,7 @@ void TextureSource::rebuildImagesAndTextures()
|
||||||
video::ITexture *t = NULL;
|
video::ITexture *t = NULL;
|
||||||
if(img)
|
if(img)
|
||||||
t = driver->addTexture(sap->name.c_str(), img);
|
t = driver->addTexture(sap->name.c_str(), img);
|
||||||
|
video::ITexture *t_old = sap->a.atlas;
|
||||||
// Replace texture
|
// Replace texture
|
||||||
sap->a.atlas = t;
|
sap->a.atlas = t;
|
||||||
sap->a.pos = v2f(0,0);
|
sap->a.pos = v2f(0,0);
|
||||||
|
@ -835,6 +835,9 @@ void TextureSource::rebuildImagesAndTextures()
|
||||||
sap->atlas_img = img;
|
sap->atlas_img = img;
|
||||||
sap->intpos = v2s32(0,0);
|
sap->intpos = v2s32(0,0);
|
||||||
sap->intsize = img->getDimension();
|
sap->intsize = img->getDimension();
|
||||||
|
|
||||||
|
if (t_old != 0)
|
||||||
|
driver->removeTexture(t_old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue