Sfoglia il codice sorgente

Avoid creation of new threads without mutex protection

Ivan Savenko 1 anno fa
parent
commit
3b3c4860b2
1 ha cambiato i file con 4 aggiunte e 6 eliminazioni
  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();
+		});
 	}
 }