Fix Stop button killing audio: use full page reload to terminate Web Workers and AudioContexts that js-dos spawns internally

This commit is contained in:
David Alvarez
2026-05-23 19:16:14 +02:00
parent 40aede0dfc
commit a3ba5f8098
+4 -15
View File
@@ -64,21 +64,10 @@
booting = false; booting = false;
} }
async function stopEmulator() { function stopEmulator() {
// Save reference then null it so the unmount cleanup doesn't double-try // Full page reload to guarantee all workers, AudioContexts,
const ci = dosCI; // and WebAssembly threads are fully terminated
dosCI = null; window.location.href = `/#/game/${game.id}`;
// Properly stop the emulator
if (ci) {
try { await ci.exit(); } catch (_) {}
}
if (dosContainer) {
dosContainer.innerHTML = "";
}
running = false;
push(`/game/${game.id}`);
} }
$effect(() => { load(); }); $effect(() => { load(); });