diff --git a/assets/webui/ofdgo_host.js b/assets/webui/ofdgo_host.js index b54a7de..cb30bfa 100644 --- a/assets/webui/ofdgo_host.js +++ b/assets/webui/ofdgo_host.js @@ -168,7 +168,8 @@ class NativeHost { const cancel = () => host.call("engine.cancel", {engine, id:data.id}).catch(() => {}); controller.signal.addEventListener("abort", cancel, {once:true}); try { - await host.call("engine.start", args, controller.signal); + await host.call("engine.start", args); + if (controller.signal.aborted) cancel(); result = await completed; await host.call("engine.finish", {engine, id:data.id}); } finally { diff --git a/internal/webview/webview.go b/internal/webview/webview.go index e998558..82cfbdd 100644 --- a/internal/webview/webview.go +++ b/internal/webview/webview.go @@ -775,6 +775,8 @@ func (h *Host) close() { cancel() } engines := h.engines + results := h.batchResults + h.batchResults = nil for _, stop := range h.engineStops { stop() } @@ -784,6 +786,9 @@ func (h *Host) close() { for _, engine := range engines { _ = engine.Close() } + for _, result := range results { + h.discard(result) + } _ = h.files.close() }