fix(bridge): one editor at a time + guard reload race

- Close other channels' editor windows before attaching a new one (Option B)
- needsReload()/setReloading() guard: skip processAudioBlock during
  terminate+reload teardown to avoid UAF/hang when reopening GUI
- Wait for editor registry cleanup (5s timeout) before creating window
This commit is contained in:
2026-08-13 15:32:35 +07:00
parent c3eb0c9d16
commit 05e4244cc8
7 changed files with 349 additions and 4 deletions
@@ -34,6 +34,13 @@ public:
// Open/close Native GUI window
virtual bool openGUI(void* parentWindowHandle) = 0;
virtual void closeGUI() = 0;
// VST3 reopen-after-close: the bridge checks before openGUI whether the
// instance must be rebuilt; while it is, the engine sets reloading=true
// and the real-time loop skips processAudioBlock (teardown must not race
// the audio thread — a reload terminates the VST while renderAll may be
// inside processAudioBlock on the same instance).
virtual bool needsReload() const { return false; }
virtual void setReloading(bool /*on*/) {}
// Real-time Audio PCM Float32 rendering loop
virtual void processAudioBlock(float* outputL, float* outputR, uint32_t numSamples) = 0;