fix: VST3 teardown under lock + re-attach hang + editor window on replace
- InstrumentEngineManager::assign: destroy replaced instrument OUTSIDE mu_ (VST3 terminate/removed can block -> audio loop stall -> bridge Not Responding, transport stop hangs, notes never off) - main.cpp LOAD job: DestroyWindow any open editor window of the channel before assign (replace VSTi -> SF2 with editor alive hung in removed()) - Vst3Instrument: reload() fresh plugin instance on second openGUI after close (Nexus etc. hang at view->attached() twice on same component)
This commit is contained in:
@@ -174,10 +174,18 @@ bool InstrumentEngineManager::assign(uint32_t channel, InstrumentType type,
|
||||
// Replacing an existing instrument drops its voices with the old engine.
|
||||
// Load may run on a detached thread (VST3 init is slow): only the map
|
||||
// write is under the mutex so renderAll on the audio loop never stalls.
|
||||
// CRITICAL: the OLD instrument is destroyed AFTER mu_ is released. VST3
|
||||
// teardown (setProcessing(false) / terminate / view removed) can block;
|
||||
// under the lock it would stall renderAll -> bridge Not Responding,
|
||||
// transport stop hangs, notes never turn off (must kill daw_engine).
|
||||
std::unique_ptr<INativeInstrument> oldInst;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mu_);
|
||||
auto it = channels_.find(channel);
|
||||
if (it != channels_.end()) oldInst = std::move(it->second);
|
||||
channels_[channel] = std::move(inst);
|
||||
}
|
||||
oldInst.reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user