make sure the user affirmatively acknowledged window deletion before deleting, fix for #1167 (#1181)

This commit is contained in:
Mike Sawka 2024-10-31 18:13:27 -07:00 committed by GitHub
parent e10bcee05a
commit 48001ee734
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -467,6 +467,8 @@ function createBaseWaveBrowserWindow(
}); });
if (choice === 0) { if (choice === 0) {
e.preventDefault(); e.preventDefault();
} else {
win.deleteAllowed = true;
} }
}); });
win.on("closed", () => { win.on("closed", () => {
@ -482,7 +484,7 @@ function createBaseWaveBrowserWindow(
if (numWindows == 0) { if (numWindows == 0) {
return; return;
} }
if (!win.alreadyClosed) { if (!win.alreadyClosed && win.deleteAllowed) {
console.log("win removing window from backend DB", win.waveWindowId); console.log("win removing window from backend DB", win.waveWindowId);
WindowService.CloseWindow(waveWindow.oid, true); WindowService.CloseWindow(waveWindow.oid, true);
} }

View File

@ -358,6 +358,7 @@ declare global {
allTabViews: Map<string, WaveTabView>; allTabViews: Map<string, WaveTabView>;
activeTabView: WaveTabView; activeTabView: WaveTabView;
alreadyClosed: boolean; alreadyClosed: boolean;
deleteAllowed: boolean;
}; };
type WaveTabView = Electron.WebContentsView & { type WaveTabView = Electron.WebContentsView & {