Skip to content

Commit

Permalink
JackClient: Lock before killing client notification thread
Browse files Browse the repository at this point in the history
The client notification thread locks a mutex before reading/writing
from/to the socket. If the thread is killed while the lock is taken it
would leave the mutex dangling.

To avoid this take the mutex and then kill the client notification thread.


Signed-off-by: Laxmi Devi <[email protected]>
  • Loading branch information
DeviLaxmii committed Aug 15, 2022
1 parent 03b8316 commit 8032ee2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/JackClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ int JackClient::Close()
Deactivate();

// Channels is stopped first to avoid receiving notifications while closing
fChannel->Stop();
JackGlobals::fSynchroMutex->Lock();
fChannel->Stop();
JackGlobals::fSynchroMutex->Unlock();
// Then close client
fChannel->ClientClose(GetClientControl()->fRefNum, &result);

Expand Down

0 comments on commit 8032ee2

Please sign in to comment.