1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 06:36:39 +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:
elsid 2022-07-27 19:51:30 +02:00
parent 201528a6e2
commit 8cecc55d64
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -530,13 +530,8 @@ bool RenderManager::isFormatSupported(MyGUI::PixelFormat /*format*/, MyGUI::Text
MyGUI::ITexture* RenderManager::createTexture(const std::string &name)
{
auto item = mTextures.find(name);
if (item != mTextures.end())
mTextures.erase(item);
item = mTextures.emplace_hint(item, name, OSGTexture(name, mImageManager));
return &item->second;
const auto it = mTextures.insert_or_assign(name, OSGTexture(name, mImageManager)).first;
return &it->second;
}
void RenderManager::destroyTexture(MyGUI::ITexture *texture)