summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFResourceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'AssetLoader/src/GLTFResourceManager.cpp')
-rw-r--r--AssetLoader/src/GLTFResourceManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/AssetLoader/src/GLTFResourceManager.cpp b/AssetLoader/src/GLTFResourceManager.cpp
index 54c3416..f3b8b8b 100644
--- a/AssetLoader/src/GLTFResourceManager.cpp
+++ b/AssetLoader/src/GLTFResourceManager.cpp
@@ -126,8 +126,10 @@ RefCntAutoPtr<ITextureAtlasSuballocation> ResourceManager::AllocateTextureSpace(
if (CacheId != nullptr && *CacheId != 0)
{
- auto inserted = m_TexAllocations.emplace(CacheId, pAllocation).second;
- VERIFY_EXPR(inserted);
+ std::lock_guard<std::mutex> Lock{m_TexAllocationsMtx};
+ // Note that the same allocation may potentially be created by more
+ // than one thread if it has not been found in the cache originally
+ m_TexAllocations.emplace(CacheId, pAllocation).second;
}
return pAllocation;