diff --git a/TCPServer.cpp b/TCPServer.cpp index 33bd42e..9506da3 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -129,8 +129,6 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) this->stopEmergency = true; - this->gameThread.~thread(); - std::vector args = TCPUtils::split(tokens[3], ","); if (!handleEmergencyFlag) { @@ -929,6 +927,8 @@ void TCPServer::handleEmergency(int distance, double angle) { awaitRobotIdle();*/ } + this->gameThread.~thread(); + this->gameStarted = false; this->gameThread = std::thread([this]() { this->startGame(); });