-
Notifications
You must be signed in to change notification settings - Fork 247
Harden checks for iChID #3909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Harden checks for iChID #3909
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,6 +221,11 @@ CJamSession::~CJamSession() | |
| */ | ||
| void CJamSession::DisconnectClient ( int iChID ) | ||
| { | ||
| if ( vecptrJamClients[iChID] == nullptr ) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| vecptrJamClients[iChID]->Disconnect(); | ||
|
|
||
| jamClientConnections.append ( new CJamClientConnection ( vecptrJamClients[iChID]->NumAudioChannels(), | ||
|
|
@@ -486,6 +491,7 @@ void CJamRecorder::OnAboutToQuit() | |
| QThread::currentThread()->exit(); | ||
| } | ||
|
|
||
| // ChIdMutex held | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" ) ); | ||
|
|
@@ -511,6 +517,7 @@ void CJamRecorder::ReaperProjectFromCurrentSession() | |
| } | ||
| } | ||
|
|
||
| // ChIdMutex held | ||
| void CJamRecorder::AudacityLofFromCurrentSession() | ||
| { | ||
| QString audacityLofFileName = currentSession->SessionDir().filePath ( currentSession->Name().append ( ".lof" ) ); | ||
|
|
@@ -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"; | ||
|
|
@@ -600,6 +606,7 @@ void CJamRecorder::OnDisconnected ( int iChID ) | |
| return; | ||
| } | ||
|
|
||
| QMutexLocker mutexLocker ( &ChIdMutex ); | ||
| currentSession->DisconnectClient ( iChID ); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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.