diff options
author | Kahrl <kahrl@gmx.net> | 2013-06-03 01:53:43 +0200 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2013-06-03 15:50:14 +0200 |
commit | b89c79e905fb6d8187c066652657c70ccb18b07d (patch) | |
tree | 077e7327c29c6b75cec414e374809bea835571c7 | |
parent | 9fe74a34ead5b774d8d0bf95d4ec83f9b323c9c6 (diff) | |
download | minetest-b89c79e905fb6d8187c066652657c70ccb18b07d.tar.gz minetest-b89c79e905fb6d8187c066652657c70ccb18b07d.tar.bz2 minetest-b89c79e905fb6d8187c066652657c70ccb18b07d.zip |
Delay deleting replaced textures (m_texture_trash)
-rw-r--r-- | src/tile.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tile.cpp b/src/tile.cpp index 5f25e123b..098a963a8 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -440,6 +440,10 @@ private: // Queued texture fetches (to be processed by the main thread) RequestQueue<std::string, u32, u8, u8> m_get_texture_queue; + + // Textures that have been overwritten with other ones + // but can't be deleted because the ITexture* might still be used + std::list<video::ITexture*> m_texture_trash; }; IWritableTextureSource* createTextureSource(IrrlichtDevice *device) @@ -485,6 +489,16 @@ TextureSource::~TextureSource() } m_atlaspointer_cache.clear(); + for (std::list<video::ITexture*>::iterator iter = + m_texture_trash.begin(); iter != m_texture_trash.end(); + iter++) + { + video::ITexture *t = *iter; + + //cleanup trashed texture + driver->removeTexture(t); + } + infostream << "~TextureSource() "<< textures_before << "/" << driver->getTextureCount() << std::endl; } @@ -870,7 +884,7 @@ void TextureSource::rebuildImagesAndTextures() sap->intsize = img->getDimension(); if (t_old != 0) - driver->removeTexture(t_old); + m_texture_trash.push_back(t_old); } } |