Crash on spawn condition trigger

Fixes  when we are removing a spawn at the same time iterating the spawn_list to trigger spawn conditions
This commit is contained in:
Image 2020-03-05 15:54:46 -05:00
parent 63c7e29e83
commit b9eb09dacd

View file

@ -3733,9 +3733,9 @@ void ZoneServer::RemoveSpawn(Spawn* spawn, bool delete_spawn, bool respawn, bool
Client* client = 0;
// Clear the pointer in the spawn list, spawn thread will remove the key
MSpawnList.readlock(__FUNCTION__, __LINE__);
spawn_list[spawn->GetID()] = 0;
MSpawnList.releasereadlock(__FUNCTION__, __LINE__);
MSpawnList.writelock(__FUNCTION__, __LINE__);
spawn_list.erase(spawn->GetID());
MSpawnList.releasewritelock(__FUNCTION__, __LINE__);
vector<Client*>::iterator client_itr;