[Localization] Fix demos by locking the mutex only when necessary

This commit is contained in:
momo5502 2017-06-05 18:44:33 +02:00
parent 92b0dcffff
commit 001939166b

View File

@ -49,6 +49,7 @@ namespace Components
if (!Localization::UseLocalization.get<bool>()) return key; if (!Localization::UseLocalization.get<bool>()) return key;
Game::LocalizeEntry* entry = nullptr; Game::LocalizeEntry* entry = nullptr;
{
std::lock_guard<std::recursive_mutex> _(Localization::LocalizeMutex); std::lock_guard<std::recursive_mutex> _(Localization::LocalizeMutex);
if (Localization::TempLocalizeMap.find(key) != Localization::TempLocalizeMap.end()) if (Localization::TempLocalizeMap.find(key) != Localization::TempLocalizeMap.end())
@ -59,6 +60,7 @@ namespace Components
{ {
entry = Localization::LocalizeMap[key]; entry = Localization::LocalizeMap[key];
} }
}
if (!entry || !entry->value) if (!entry || !entry->value)
{ {