diff --git a/common/JackClient.cpp b/common/JackClient.cpp index 5befdfbde..42374c7d1 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -107,14 +107,17 @@ int JackClient::Close() int result = 0; Deactivate(); + + assert(JackGlobals::fSynchroMutex); // 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); fChannel->Close(); - assert(JackGlobals::fSynchroMutex); JackGlobals::fSynchroMutex->Lock(); fSynchroTable[GetClientControl()->fRefNum].Disconnect(); JackGlobals::fSynchroMutex->Unlock();