mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-06 12:51:42 +02:00
fix server crash on control client disconnect (quit, exit, bye)
This commit is contained in:
parent
fa9715684b
commit
b56d656c32
3 changed files with 12 additions and 13 deletions
|
@ -83,7 +83,10 @@ void ControlServer::onMessageReceived(ControlSession* connection, const std::str
|
|||
{
|
||||
if (it->get() == connection)
|
||||
{
|
||||
sessions_.erase(it);
|
||||
/// delete in a thread to avoid deadlock
|
||||
auto func = [&](std::shared_ptr<ControlSession> s)->void{sessions_.erase(s);};
|
||||
std::thread t(func, *it);
|
||||
t.detach();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue