fix(bridge): VSTi GUI crash on instrument switch — PostMessage WM_CLOSE instead of cross-thread DestroyWindow

- LOAD job posts WM_CLOSE to window created on main thread (DestroyWindow from worker crashed 0xc000041d, muting all tracks)
- handleOpenGui + attach jobs skip when Vst3Instrument::hasAttachedView() (state_ && guiAttached_)
- attach failure posts WM_CLOSE; post_close_gui erases entry only when it points at the same hwnd
- cap openVstGuiRetry at 5 to stop frontend retry spam
This commit is contained in:
2026-08-14 10:18:22 +07:00
parent f7f20e3a0a
commit 35499b614c
5 changed files with 54 additions and 12 deletions
@@ -46,6 +46,10 @@ public:
// with the channel worker pumping messages (see bridge main.cpp).
virtual bool reloadForGUI() { return true; }
virtual bool attachView(void* /*parentWindowHandle*/) { return false; }
// True while the editor view is attached (GUI window open). The bridge uses
// it to dedupe repeated OPEN_GUI (frontend retry spam) — re-attaching a
// view that is already attached corrupts plugins (Nexus createView→null).
virtual bool hasAttachedView() const { return false; }
// Real-time Audio PCM Float32 rendering loop
virtual void processAudioBlock(float* outputL, float* outputR, uint32_t numSamples) = 0;
+1
View File
@@ -27,6 +27,7 @@ public:
bool openGUI(void* parentWindowHandle) override;
bool reloadForGUI() override;
bool attachView(void* parentWindowHandle) override;
bool hasAttachedView() const override;
void closeGUI() override;
void setChannel(uint32_t ch) { channel_ = ch; }
bool needsReload() const override { return hasAttachedOnce_ && !guiAttached_; }