소스 검색

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 년 전
부모
커밋
b9eb09dacd
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  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;