1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-09 07:13:54 +02:00

Fixed deadlock in WaterAdopter

This commit is contained in:
Tomasz Zieliński 2023-05-19 20:49:01 +02:00
parent 73d9f5bd0a
commit 72f8facc82

View File

@ -35,7 +35,6 @@ void WaterAdopter::process()
void WaterAdopter::init()
{
//make dependencies
DEPENDENCY_ALL(WaterAdopter);
DEPENDENCY(TownPlacer);
POSTFUNCTION(ConnectionsPlacer);
POSTFUNCTION(TreasurePlacer);
@ -224,7 +223,10 @@ void WaterAdopter::createWater(EWaterContent::EWaterContent waterContent)
}
}
map.getZones()[waterZoneId]->area().unite(waterArea);
{
Zone::Lock waterLock(map.getZones()[waterZoneId]->areaMutex);
map.getZones()[waterZoneId]->area().unite(waterArea);
}
Zone::Lock lock(zone.areaMutex);
zone.area().subtract(waterArea);
zone.areaPossible().subtract(waterArea);