Skip to content

Commit a26fcab

Browse files
committed
Clear thread task queues on exit
We need to release any shared pointers in the closures. This solves potentially destroying clients later than intended, when the thread data is destroyed in the main thread on exit, after the threads are gone already.
1 parent 59b5db3 commit a26fcab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

threaddata.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ void ThreadData::acceptPendingBridges()
846846

847847
void ThreadData::deleteClients()
848848
{
849+
// Can have shared pointers to clients
850+
taskQueue.lock()->clear();
851+
delayedTasks.clear();
852+
849853
clients.by_fd.clear();
850854
clients.bridges.clear();
851855
acceptQueue.clients.lock()->clear();

0 commit comments

Comments
 (0)