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:
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)
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue