Browse Source

Deadlock fix for SpellProcess

11:32:06 E Mutex     : The mutex SpellProcess::SpellCancelList called from AddSpellCancel at line 2266 timed out waiting on another writelock!
11:32:06 E Mutex     : The following functions had locks:
11:32:06 E Mutex     : Process, number of locks = 1
Image 4 years ago
parent
commit
569f9e8df2
1 changed files with 8 additions and 1 deletions
  1. 8 1
      EQ2/source/WorldServer/SpellProcess.cpp

+ 8 - 1
EQ2/source/WorldServer/SpellProcess.cpp

@@ -139,14 +139,21 @@ void SpellProcess::Process(){
 		}
 	}
 	if (SpellCancelList.size() > 0){
+		std::vector<LuaSpell*> tmpList;
 		MSpellCancelList.writelock(__FUNCTION__, __LINE__);
 		vector<LuaSpell*>::iterator itr = SpellCancelList.begin();
 		while (itr != SpellCancelList.end()){
-			DeleteCasterSpell(*itr);
+			tmpList.push_back(*itr);
 			itr++;
 		}
 		SpellCancelList.clear();
 		MSpellCancelList.releasewritelock(__FUNCTION__, __LINE__);
+
+		itr = tmpList.begin();
+		while (itr != tmpList.end()) {
+			DeleteCasterSpell(*itr);
+			itr++;
+		}
 	}
 	if(interrupt_list.size(true) > 0){		
 		InterruptStruct* interrupt = 0;