Skip to content

Commit

Permalink
DlgAudioUnit: Wait for instantiation before loading UI
Browse files Browse the repository at this point in the history
This fixes a race condition
  • Loading branch information
fwcd committed Nov 30, 2024
1 parent f9568b5 commit 8dca13f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/effects/backends/audiounit/dlgaudiounit.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
qDebug() << "Loading UI of Audio Unit" << name << "with width" << size.width
<< "and height" << size.height;

const int TIMEOUT_MS = 2000;
if (!pManager->waitForAudioUnit(TIMEOUT_MS)) {
return "Instantiating the UI took more than " +
QString::number(TIMEOUT_MS) +
"ms, try closing and reopening the UI!";
}

AudioUnit _Nullable audioUnit = pManager->getAudioUnit();

if (audioUnit == nil) {
Expand Down

0 comments on commit 8dca13f

Please sign in to comment.