Browse Source

Crash on spawn condition trigger

Fixes #20 when we are removing a spawn at the same time iterating the spawn_list to trigger spawn conditions
Image 4 years ago
parent
commit
b9eb09dacd
1 changed files with 3 additions and 3 deletions
  1. 3 3
      EQ2/source/WorldServer/zoneserver.cpp

+ 3 - 3
EQ2/source/WorldServer/zoneserver.cpp

@@ -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;