diff --git a/src/Components/Modules/Discovery.cpp b/src/Components/Modules/Discovery.cpp index 2e4fa8c0..633dd8aa 100644 --- a/src/Components/Modules/Discovery.cpp +++ b/src/Components/Modules/Discovery.cpp @@ -109,7 +109,5 @@ namespace Components { Discovery::Thread.join(); } - - Discovery::Thread = std::thread(); } } diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 0fc228e5..593e5ecf 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -828,12 +828,6 @@ namespace Components Download::~Download() { - Download::Terminate = true; - if (Download::ServerThread.joinable()) - { - Download::ServerThread.join(); - } - if (Dedicated::IsEnabled()) { mg_mgr_free(&Download::Mgr); @@ -842,6 +836,12 @@ namespace Components void Download::preDestroy() { + Download::Terminate = true; + if (Download::ServerThread.joinable()) + { + Download::ServerThread.join(); + } + if (!Dedicated::IsEnabled()) { Download::CLDownload.clear(); diff --git a/src/Components/Modules/IPCPipe.cpp b/src/Components/Modules/IPCPipe.cpp index 57346dcc..9fe6b2a8 100644 --- a/src/Components/Modules/IPCPipe.cpp +++ b/src/Components/Modules/IPCPipe.cpp @@ -129,8 +129,6 @@ namespace Components Logger::Print("Pipe thread terminated.\n"); } - - this->thread = std::thread(); } void Pipe::setName(std::string name)