WS30: Fix deadlock introduced by fb436be8f1

This commit is contained in:
Stuart Buchanan 2021-08-01 20:47:38 +01:00
parent 2039f49691
commit 4f01f758ae

View File

@ -245,10 +245,11 @@ SGMaterial *SGMaterialLib::find( int lc, const SGGeod& center ) const
SGMaterialCache *SGMaterialLib::generateMatCache(SGVec2f center, const simgear::SGReaderWriterOptions* options) SGMaterialCache *SGMaterialLib::generateMatCache(SGVec2f center, const simgear::SGReaderWriterOptions* options)
{ {
std::lock_guard<std::mutex> g(d->mutex);
SGMaterialCache* newCache = new SGMaterialCache(getMaterialTextureAtlas(center, options)); SGMaterialCache* newCache = new SGMaterialCache(getMaterialTextureAtlas(center, options));
std::lock_guard<std::mutex> g(d->mutex);
material_map::const_reverse_iterator it = matlib.rbegin(); material_map::const_reverse_iterator it = matlib.rbegin();
for (; it != matlib.rend(); ++it) { for (; it != matlib.rend(); ++it) {
newCache->insert(it->first, internalFind(it->first, center)); newCache->insert(it->first, internalFind(it->first, center));