fix: ensure all daw_engine exit on app close (abrupt kill + LAN client open)

- desktop_engine: watchdog parent check via WaitForSingleObject(SYNCHRONIZE)
  instead of OpenProcess — killed parents linger as zombie objects, OpenProcess
  succeeds forever and watchdog never fires; hard-exit after 5s if graceful
  shutdown hangs (open LAN connection)
- lib.rs: Destroyed handler sweeps any orphan daw_engine/daw_vst_bridge by
  image name before exit(0), covering manual-launch and stale engines
This commit is contained in:
2026-08-16 21:18:21 +07:00
parent cead8c8c71
commit 98574aa0ea
3 changed files with 35 additions and 3 deletions
+12
View File
@@ -671,6 +671,18 @@ pub fn run() {
// phu/an giu event loop song, Tauri khong tu exit; exit(0)
// ket thuc dut diem (pump da dung, khong con respawn bridge).
if window.label() == "main" {
// Orphan sweep: bat CA dau engine con song theo image name —
// engine spawn thu cong (khong co SF_PARENT_PID), engine cua
// lan chay truoc bi crash, hoac engine song sot khi app chet
// dot ngot (watchdog graceful shutdown treo vi LAN client).
// Task Manager dong app -> Destroyed khong chay -> engine tu
// thoat nho watchdog; o day dong app binh thuong -> quet het.
let _ = std::process::Command::new("taskkill")
.args(["/IM", "daw_engine.exe", "/T", "/F"])
.status();
let _ = std::process::Command::new("taskkill")
.args(["/IM", "daw_vst_bridge.exe", "/T", "/F"])
.status();
window.app_handle().exit(0);
}
}