From 48001ee7343741a706fae1d680bafb7655711e17 Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Thu, 31 Oct 2024 18:13:27 -0700 Subject: [PATCH] make sure the user affirmatively acknowledged window deletion before deleting, fix for #1167 (#1181) --- emain/emain-viewmgr.ts | 4 +++- frontend/types/custom.d.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emain/emain-viewmgr.ts b/emain/emain-viewmgr.ts index 535ff3817..74838ee36 100644 --- a/emain/emain-viewmgr.ts +++ b/emain/emain-viewmgr.ts @@ -467,6 +467,8 @@ function createBaseWaveBrowserWindow( }); if (choice === 0) { e.preventDefault(); + } else { + win.deleteAllowed = true; } }); win.on("closed", () => { @@ -482,7 +484,7 @@ function createBaseWaveBrowserWindow( if (numWindows == 0) { return; } - if (!win.alreadyClosed) { + if (!win.alreadyClosed && win.deleteAllowed) { console.log("win removing window from backend DB", win.waveWindowId); WindowService.CloseWindow(waveWindow.oid, true); } diff --git a/frontend/types/custom.d.ts b/frontend/types/custom.d.ts index f80859197..42d4dc78d 100644 --- a/frontend/types/custom.d.ts +++ b/frontend/types/custom.d.ts @@ -358,6 +358,7 @@ declare global { allTabViews: Map; activeTabView: WaveTabView; alreadyClosed: boolean; + deleteAllowed: boolean; }; type WaveTabView = Electron.WebContentsView & {