From 83247b56f979ff29e5107c7bef3091348cc1e20d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 8 Dec 2020 11:39:45 -0600 Subject: [PATCH] Destroy all tabs when a window is closed (fix #1871) --- app/bg/ui/tabs/manager.js | 7 +++++++ app/bg/ui/windows.js | 1 + 2 files changed, 8 insertions(+) diff --git a/app/bg/ui/tabs/manager.js b/app/bg/ui/tabs/manager.js index 478fa2c708..6fac46fa58 100644 --- a/app/bg/ui/tabs/manager.js +++ b/app/bg/ui/tabs/manager.js @@ -884,6 +884,13 @@ export async function remove (win, tab) { emitReplaceState(win) } +export async function destroyAll (win) { + for (let t of (activeTabs[win.id] || [])) { + t.destroy() + } + delete activeTabs[win.id] +} + export async function removeAllExcept (win, tab) { win = getTopWindow(win) var tabs = getAll(win).slice() // .slice() to duplicate the list diff --git a/app/bg/ui/windows.js b/app/bg/ui/windows.js index 3b4383c09d..575845a93b 100644 --- a/app/bg/ui/windows.js +++ b/app/bg/ui/windows.js @@ -240,6 +240,7 @@ export function createShellWindow (windowState, createOpts = {dontInitPages: fal for (let k in subwindows) { subwindows[k].destroy(win) } + tabManager.destroyAll(win) }) async function handlePagesReady ({ sender }) {