Browse Source

Avoid creation of new threads without mutex protection

Ivan Savenko 1 year ago
parent
commit
3b3c4860b2
1 changed files with 4 additions and 6 deletions
  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>())
 		if(auto iw = GH.windows().topWindow<CInfoWindow>())
 			iw->close();
 			iw->close();
 
 
-		boost::thread newThread([this]()
-			{
-				hotkeyEndingTurn();
-			});
-
-		newThread.detach();
+		GH.dispatchMainThread([this]()
+		{
+			hotkeyEndingTurn();
+		});
 	}
 	}
 }
 }