1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

fixed possible race condition

This commit is contained in:
AlexVinS
2017-07-12 19:40:14 +03:00
parent 78885b8acc
commit 09df2dcfbb
3 changed files with 19 additions and 9 deletions

View File

@@ -1355,8 +1355,10 @@ void startGame(StartInfo * options, CConnection *serv/* = nullptr*/)
client->loadGame(fname,vm.count("loadserver"),vm.count("loadhumanplayerindices") ? vm["loadhumanplayerindices"].as<std::vector<int>>() : std::vector<int>(),vm.count("loadnumplayers") ? vm["loadnumplayers"].as<int>() : 1,vm["loadplayer"].as<int>(),vm.count("loadserverip") ? vm["loadserverip"].as<std::string>() : "", vm.count("loadserverport") ? vm["loadserverport"].as<ui16>() : CServerHandler::getDefaultPort());
break;
}
client->connectionHandler = new boost::thread(&CClient::run, client);
{
TLockGuard _(client->connectionHandlerMutex);
client->connectionHandler = make_unique<boost::thread>(&CClient::run, client);
}
}
void endGame()