Fix GUI Qin không hiện lại sau hide + âm thanh lỗi sau khi đóng cửa sổ

- plugin_host_main.cpp: chặn WM_CLOSE (đóng GUI nhưng giữ window sống, hide
  thay vì destroy), WM_DESTROY reset hwnd; dùng g_hostHwnd toàn cục thay
  hwnd local để control OPEN_GUI/CLOSE_GUI tái sử dụng đúng window.
- main.cpp: bỏ qua dedupe hasAttachedView cho instrument child-own
  (SandboxVst2Host) — bridge guiOpen_ stale sau khi child tự đóng nên
  OPEN_GUI lặp lại phải forward control 4; child tự chặn double-open.
- Verify: WM_CLOSE -> window ẩn còn sống; OPEN_GUI lần 2 -> window hiện lại,
  âm ch1 vẫn kêu (peak 0.15), không câm.
This commit is contained in:
2026-08-21 09:21:56 +07:00
parent a7b01d3484
commit e7e974b3e0
2 changed files with 44 additions and 12 deletions
+2 -2
View File
@@ -1096,7 +1096,7 @@ int main(int argc, char* argv[]) {
// attached -> GUI da mo, khong post attach job lan nua. Re-attach
// tren view dang attached lam plugin loi (Nexus createView null).
if (instruments.withInstrument(guiCh, [](INativeInstrument* i0) {
return i0 && i0->hasAttachedView();
return i0 && i0->hasAttachedView() && !i0->ownsGuiWindow();
})) {
return;
}
@@ -1120,7 +1120,7 @@ int main(int argc, char* argv[]) {
return;
}
if (auto* inst0 = instruments.get(guiCh)) {
if (inst0->hasAttachedView()) {
if (inst0->hasAttachedView() && !inst0->ownsGuiWindow()) {
// Dedupe race: main da silence (setReloading) truoc khi post —
// restore de channel khong cam vinh vien.
std::vector<uint32_t> sp = same_plugin_channels(guiCh);