Tiny threads fixes & a little bit of safety

This commit is contained in:
k1-801 2020-11-15 16:00:59 +04:00 committed by Adam Honse
parent 9a53709db0
commit dde857dfb4
18 changed files with 85 additions and 154 deletions

View file

@ -42,7 +42,7 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
NetworkClient::~NetworkClient()
{
delete ConnectionThread;
StopClient();
}
void NetworkClient::ClientInfoChanged()
@ -145,8 +145,17 @@ void NetworkClient::StopClient()
}
if(ListenThread)
{
ListenThread->join();
ConnectionThread->join();
delete ListenThread;
ListenThread = nullptr;
}
if(ConnectionThread)
{
ConnectionThread->join();
delete ConnectionThread;
ConnectionThread = nullptr;
}
/*-------------------------------------------------*\
| Client info has changed, call the callbacks |