Browse Source

Fixed CID 1288860

AlexVinS 9 years ago
parent
commit
4e28efb8b4
1 changed files with 2 additions and 3 deletions
  1. 2 3
      client/battle/CBattleInterface.cpp

+ 2 - 3
client/battle/CBattleInterface.cpp

@@ -2807,7 +2807,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
 
 	boost::thread aiThread([&]
 	{
-		auto ba = new BattleAction(curInt->autofightingAI->activeStack(activeStack));
+		auto ba = make_unique<BattleAction>(curInt->autofightingAI->activeStack(activeStack));
 
 		if (curInt->isAutoFightOn)
 		{
@@ -2823,12 +2823,11 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
 			}
 			else
 			{
-				givenCommand->setn(ba);
+				givenCommand->setn(ba.release());
 			}
 		}
 		else
 		{
-			delete ba;
 			boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
 			activateStack();
 		}