G2.4: skip redundant LOAD of already-loaded instrument (keep restored preset)

This commit is contained in:
2026-08-16 07:47:53 +07:00
parent 4faa5a3504
commit c2ae452844
3 changed files with 14 additions and 3 deletions
+10
View File
@@ -1129,6 +1129,16 @@ int main(int argc, char* argv[]) {
std::string path(c.arg2, plen);
InstrumentType t = (InstrumentType)c.arg0;
uint32_t ch = c.channel & 0xF;
uiWorker.post([&instruments, t, ch, path, sampleRate, block]() {
// G2.4: double-load guard - sau respawn/bootstrap, JS
// reconnect reload gui LOAD cung path (C++ da tu restore
// tu state file); thay instance se mat preset. Skip khi
// channel da co DUNG instrument nay.
if (!path.empty() && !lower_plugin_path(ch).empty() &&
lower_plugin_path(ch) == lower_path_str(path)) {
std::cout << "[NativeBridge] LOAD skip ch=" << ch
<< " (already loaded: " << path << ")" << std::endl;
return;
}
// CRASH FIX: this job enters the plugin DLL (createInstance
// in loadPlugin, old-instance terminate on replace) while