From b3756032587a3df9d0080ddf368773c5f7010ac8 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Wed, 29 Apr 2026 18:59:35 +0800 Subject: [PATCH] On Window.close, remove any queued navigation --- src/browser/webapi/Window.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/browser/webapi/Window.zig b/src/browser/webapi/Window.zig index 807816bf..d67b174b 100644 --- a/src/browser/webapi/Window.zig +++ b/src/browser/webapi/Window.zig @@ -555,6 +555,19 @@ pub fn close(self: *Window) void { } _ = page.popups.swapRemove(popup_index); + + // Drop any pending queued navigation for this frame. Frame.deinit will + // release the QueuedNavigation arena, but the entry in page.queued_navigation + // would otherwise have processQueuedNavigation re-deinit the popup. + if (frame._queued_navigation != null) { + for (page.queued_navigation.items, 0..) |f, i| { + if (f == frame) { + _ = page.queued_navigation.swapRemove(i); + break; + } + } + } + frame.deinit(true); }