diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index de99ac9b5b..84189c9684 100644 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -221,6 +221,12 @@ CJamSession::~CJamSession() */ void CJamSession::DisconnectClient ( int iChID ) { + if ( vecptrJamClients[iChID] == nullptr ) + { + chIdDisconnected = iChID; + return; + } + vecptrJamClients[iChID]->Disconnect(); jamClientConnections.append ( new CJamClientConnection ( vecptrJamClients[iChID]->NumAudioChannels(), @@ -486,6 +492,7 @@ void CJamRecorder::OnAboutToQuit() QThread::currentThread()->exit(); } +// ChIdMutex held void CJamRecorder::ReaperProjectFromCurrentSession() { QString reaperProjectFileName = currentSession->SessionDir().filePath ( currentSession->Name().append ( ".rpp" ) ); @@ -511,6 +518,7 @@ void CJamRecorder::ReaperProjectFromCurrentSession() } } +// ChIdMutex held void CJamRecorder::AudacityLofFromCurrentSession() { QString audacityLofFileName = currentSession->SessionDir().filePath ( currentSession->Name().append ( ".lof" ) ); @@ -589,7 +597,6 @@ void CJamRecorder::SessionDirToReaper ( QString& strSessionDirName, int serverFr */ void CJamRecorder::OnDisconnected ( int iChID ) { - QMutexLocker mutexLocker ( &ChIdMutex ); if ( !isRecording ) { qWarning() << "CJamRecorder::OnDisconnected: channel" << iChID << "disconnected but not recording"; @@ -600,6 +607,7 @@ void CJamRecorder::OnDisconnected ( int iChID ) return; } + QMutexLocker mutexLocker ( &ChIdMutex ); currentSession->DisconnectClient ( iChID ); }