From 32f7a95e38576d7abe217884ab94f817834920ce Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 25 Jul 2023 18:50:55 +0300 Subject: [PATCH] Use capture by value since thread might start after local method returns --- client/battle/BattleInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/battle/BattleInterface.cpp b/client/battle/BattleInterface.cpp index 53fb5f3c7..1f49a635c 100644 --- a/client/battle/BattleInterface.cpp +++ b/client/battle/BattleInterface.cpp @@ -727,7 +727,7 @@ void BattleInterface::requestAutofightingAIToTakeAction() // FIXME: unsafe // Run task in separate thread to avoid UI lock while AI is making turn (which might take some time) // HOWEVER this thread won't atttempt to lock game state, potentially leading to races - boost::thread aiThread([&]() + boost::thread aiThread([this, activeStack]() { curInt->autofightingAI->activeStack(activeStack); });