Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/recorder/jamrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ CJamSession::~CJamSession()
*/
void CJamSession::DisconnectClient ( int iChID )
{
if ( vecptrJamClients[iChID] == nullptr )
{
return;
}
Comment on lines +224 to +227

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI: Confirmed on this branch: 390 guarded early returns, 389 of them followed by a frame that allocated a fresh CJamClient; a second run, 220 and 219. Once the guard fires, the late frame is the normal continuation, not an edge case.


vecptrJamClients[iChID]->Disconnect();

jamClientConnections.append ( new CJamClientConnection ( vecptrJamClients[iChID]->NumAudioChannels(),
Expand Down Expand Up @@ -486,6 +491,7 @@ void CJamRecorder::OnAboutToQuit()
QThread::currentThread()->exit();
}

// ChIdMutex held

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rather @requires or something else that basically says that the mutex must be held here. Isn't there a way to check if the mutex is held code wise and else just return with error?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you noticing that the reader locks, but the writers do not? I plan a PR for it, after this one is merged.

void CJamRecorder::ReaperProjectFromCurrentSession()
{
QString reaperProjectFileName = currentSession->SessionDir().filePath ( currentSession->Name().append ( ".rpp" ) );
Expand All @@ -511,6 +517,7 @@ void CJamRecorder::ReaperProjectFromCurrentSession()
}
}

// ChIdMutex held
void CJamRecorder::AudacityLofFromCurrentSession()
{
QString audacityLofFileName = currentSession->SessionDir().filePath ( currentSession->Name().append ( ".lof" ) );
Expand Down Expand Up @@ -589,7 +596,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";
Expand All @@ -600,6 +606,7 @@ void CJamRecorder::OnDisconnected ( int iChID )
return;
}

QMutexLocker mutexLocker ( &ChIdMutex );
currentSession->DisconnectClient ( iChID );
}

Expand Down
Loading