瀏覽代碼

Avoid creation of new threads without mutex protection

Ivan Savenko 1 年之前
父節點
當前提交
3b3c4860b2
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      client/adventureMap/AdventureMapInterface.cpp

+ 4 - 6
client/adventureMap/AdventureMapInterface.cpp

@@ -441,12 +441,10 @@ void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
 		if(auto iw = GH.windows().topWindow<CInfoWindow>())
 			iw->close();
 
-		boost::thread newThread([this]()
-			{
-				hotkeyEndingTurn();
-			});
-
-		newThread.detach();
+		GH.dispatchMainThread([this]()
+		{
+			hotkeyEndingTurn();
+		});
 	}
 }