File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,10 @@ class TextureSource : public IWritableTextureSource
440
440
441
441
// Queued texture fetches (to be processed by the main thread)
442
442
RequestQueue<std::string, u32, u8, u8> m_get_texture_queue;
443
+
444
+ // Textures that have been overwritten with other ones
445
+ // but can't be deleted because the ITexture* might still be used
446
+ std::list<video::ITexture*> m_texture_trash;
443
447
};
444
448
445
449
IWritableTextureSource* createTextureSource (IrrlichtDevice *device)
@@ -485,6 +489,16 @@ TextureSource::~TextureSource()
485
489
}
486
490
m_atlaspointer_cache.clear ();
487
491
492
+ for (std::list<video::ITexture*>::iterator iter =
493
+ m_texture_trash.begin (); iter != m_texture_trash.end ();
494
+ iter++)
495
+ {
496
+ video::ITexture *t = *iter;
497
+
498
+ // cleanup trashed texture
499
+ driver->removeTexture (t);
500
+ }
501
+
488
502
infostream << " ~TextureSource() " << textures_before << " /"
489
503
<< driver->getTextureCount () << std::endl;
490
504
}
@@ -870,7 +884,7 @@ void TextureSource::rebuildImagesAndTextures()
870
884
sap->intsize = img->getDimension ();
871
885
872
886
if (t_old != 0 )
873
- driver-> removeTexture (t_old);
887
+ m_texture_trash. push_back (t_old);
874
888
}
875
889
}
876
890
You can’t perform that action at this time.
0 commit comments