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:
@@ -6213,11 +6213,11 @@ const ensureAndOpenVstGui = async (trackId, instrumentId) => {
|
||||
try { await openVstGuiRetry(instrumentId, bch, 20); } catch (e) { console.warn('[Bridge] openNativeGUI fail:', e); }
|
||||
};
|
||||
// V8 bug 4 + V9 bug 3/6/7: C++ load instrument ASYNC (worker thread) — OPEN_GUI
|
||||
// som → C++ defer (chi log stderr, invoke van tra Ok) → retry PHAI chay DU so
|
||||
// lan, khong `return true` som. Mo GUI co the can cho den khi assign() xong
|
||||
// (Nexus ~1-2s) — 20 lan x 500ms, window reuse khi load xong.
|
||||
// som → C++ defer va tu fulfil khi assign() xong (pending-GUI sweep) → khong
|
||||
// can spam. 20 lan x 500ms tao deferred storm (50+ event/moi restart) va
|
||||
// re-attach view dang attached (crash USER32 0xc000041d). Cap 5.
|
||||
const openVstGuiRetry = async (instrumentId, bch, attempts) => {
|
||||
const n = (attempts && attempts > 0) ? attempts : 20;
|
||||
const n = Math.min((attempts && attempts > 0) ? attempts : 5, 5);
|
||||
for (let i = 0; i < n; i++) {
|
||||
try { await window.NativeBridgeService.openNativeGUI(instrumentId, bch); }
|
||||
catch (e) { console.warn('[Bridge] openNativeGUI retry', i + 1, e); }
|
||||
|
||||
Reference in New Issue
Block a user