From 95fd6c96db0853b805aba9080af1dc1c72cabcb1 Mon Sep 17 00:00:00 2001 From: Pete Miller Date: Wed, 21 Feb 2018 14:24:13 -0800 Subject: [PATCH] When closing last window, make sure buffer window is closed so that app exits. Only on win/linux, since we only handle 'window-all-closed' on those platforms. Fix #13233 --- app/browser/windows.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/browser/windows.js b/app/browser/windows.js index 621328fa1c5..2f62826530d 100644 --- a/app/browser/windows.js +++ b/app/browser/windows.js @@ -334,6 +334,16 @@ const api = { win.once('closed', () => { appActions.windowClosed(windowId) cleanupWindow(windowId) + // if we have a bufferWindow, the 'window-all-closed' + // event will not fire once the last window is closed, + // so close the buffer window if this is the last closed window + // apart from the buffer window + if (!platformUtil.isDarwin() && api.getBufferWindow()) { + const remainingWindows = api.getAllRendererWindows().filter(win => win !== api.getBufferWindow()) + if (!remainingWindows.length) { + api.closeBufferWindow() + } + } }) win.on('blur', () => { appActions.windowBlurred(windowId)