Added mutex to resource manager cache reading to avoid a potential race condition. We hope this is the actual bug we saw.
This commit is contained in:
@@ -200,6 +200,8 @@ static T* ResourceManager::Load(const std::string& resourceName, Resource* paren
|
||||
}
|
||||
|
||||
//If resource has already been cached and completely loaded.
|
||||
{
|
||||
boost::lock_guard<decltype(m_Mutex)> guard(m_Mutex);
|
||||
it = m_ResourceCache.find(cacheKey);
|
||||
if (it != m_ResourceCache.end()) {
|
||||
if (it->second != nullptr) {
|
||||
@@ -209,6 +211,7 @@ static T* ResourceManager::Load(const std::string& resourceName, Resource* paren
|
||||
throw Resource::FailedLoadingException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If resource is not cached..
|
||||
if (UseThreading && async) {
|
||||
|
||||
Reference in New Issue
Block a user