Browse Source

deadlock fix on RotateTo

Image 3 years ago
parent
commit
e2c53de1d5
1 changed files with 4 additions and 1 deletions
  1. 4 1
      EQ2/source/WorldServer/Zone/mob_movement_manager.cpp

+ 4 - 1
EQ2/source/WorldServer/Zone/mob_movement_manager.cpp

@@ -550,7 +550,9 @@ void MobMovementManager::AddMob(Entity *mob)
 void MobMovementManager::RemoveMob(Entity *mob)
 {
 	MobListMutex.writelock();
-	_impl->Entries.erase(mob);
+	auto iter = _impl->Entries.find(mob);
+	if(iter != _impl->Entries.end())
+		_impl->Entries.erase(iter);
 	MobListMutex.releasewritelock();
 }
 
@@ -597,6 +599,7 @@ void MobMovementManager::RotateTo(Entity *who, float to, MobMovementMode mob_mov
 	auto &ent = (*iter);
 
 	if (true != ent.second.Commands.empty()) {
+		MobListMutex.releasereadlock();
 		return;
 	}