From a3ba5f8098352082d18daf824db85474dbd875fb Mon Sep 17 00:00:00 2001 From: David Alvarez Date: Sat, 23 May 2026 19:16:14 +0200 Subject: [PATCH] Fix Stop button killing audio: use full page reload to terminate Web Workers and AudioContexts that js-dos spawns internally --- frontend/src/pages/Play.svelte | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/frontend/src/pages/Play.svelte b/frontend/src/pages/Play.svelte index 4498024..23627e1 100644 --- a/frontend/src/pages/Play.svelte +++ b/frontend/src/pages/Play.svelte @@ -64,21 +64,10 @@ booting = false; } - async function stopEmulator() { - // Save reference then null it so the unmount cleanup doesn't double-try - const ci = dosCI; - dosCI = null; - - // Properly stop the emulator - if (ci) { - try { await ci.exit(); } catch (_) {} - } - if (dosContainer) { - dosContainer.innerHTML = ""; - } - - running = false; - push(`/game/${game.id}`); + function stopEmulator() { + // Full page reload to guarantee all workers, AudioContexts, + // and WebAssembly threads are fully terminated + window.location.href = `/#/game/${game.id}`; } $effect(() => { load(); });