mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-15 17:46:37 +00:00
Fix inserting texture to map
Avoid using invalidated iterator after erase call. Use insert_or_assing instead of operator[] because OSGTexture doesn't have a default constructor.
This commit is contained in:
parent
201528a6e2
commit
8cecc55d64
1 changed files with 2 additions and 7 deletions
|
@ -530,13 +530,8 @@ bool RenderManager::isFormatSupported(MyGUI::PixelFormat /*format*/, MyGUI::Text
|
||||||
|
|
||||||
MyGUI::ITexture* RenderManager::createTexture(const std::string &name)
|
MyGUI::ITexture* RenderManager::createTexture(const std::string &name)
|
||||||
{
|
{
|
||||||
auto item = mTextures.find(name);
|
const auto it = mTextures.insert_or_assign(name, OSGTexture(name, mImageManager)).first;
|
||||||
if (item != mTextures.end())
|
return &it->second;
|
||||||
mTextures.erase(item);
|
|
||||||
|
|
||||||
item = mTextures.emplace_hint(item, name, OSGTexture(name, mImageManager));
|
|
||||||
|
|
||||||
return &item->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderManager::destroyTexture(MyGUI::ITexture *texture)
|
void RenderManager::destroyTexture(MyGUI::ITexture *texture)
|
||||||
|
|
Loading…
Reference in a new issue