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 750aa99 commit fbdc633
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 (!manager->waitForAudioUnit(TIMEOUT_MS)) {
return "Instantiating the UI took more than " +
QString::number(TIMEOUT_MS) +
"ms, try closing and reopening the UI!";
}

AudioUnit _Nullable audioUnit = manager->getAudioUnit();

if (audioUnit == nil) {
Expand Down

0 comments on commit fbdc633

Please sign in to comment.