fix crash daw_vst_bridge khi đóng editor Nexus đang play: reload instance trong close job + silence same-plugin quanh createInstance/createView

This commit is contained in:
2026-08-14 16:52:53 +07:00
parent 0696545ae9
commit af59aaf257
5 changed files with 325 additions and 56 deletions
@@ -41,6 +41,11 @@ public:
// inside processAudioBlock on the same instance).
virtual bool needsReload() const { return false; }
virtual void setReloading(bool /*on*/) {}
// VST3: rebuild the plugin instance (terminate + loadPlugin) on the owning
// apartment thread. The bridge calls it after tearing an editor down so the
// audio loop never processes an instance whose editor was dropped without
// view->removed(). Non-VST engines: no-op.
virtual bool reload() { return true; }
// VST3: split openGUI so instance teardown/reload runs on the owning
// apartment thread while view->attached() may run on a temporary thread
// with the channel worker pumping messages (see bridge main.cpp).
+1 -1
View File
@@ -29,6 +29,7 @@ public:
bool attachView(void* parentWindowHandle) override;
bool hasAttachedView() const override;
void closeGUI() override;
bool reload() override;
void setChannel(uint32_t ch) { channel_ = ch; }
bool needsReload() const override { return hasAttachedOnce_ && !guiAttached_; }
void setReloading(bool on) override { reloading_ = on; }
@@ -45,7 +46,6 @@ private:
bool hasAttachedOnce_;
bool reloading_; // guarded by InstrumentEngineManager::mu_ (set via setReloading)
uint32_t channel_ = 0;
bool reload();
};
#endif // VST3_INSTRUMENT_H