@@ -922,8 +922,28 @@ async function chooseFromFileSystem(targetWindow, options, joinListChar) {
922922}
923923
924924async function executeAppQuit ( ) {
925- for ( const window of BrowserWindow . getAllWindows ( ) ) {
926- sendToWindow ( window , 'start-app-quit' ) ;
925+ const windows = BrowserWindow . getAllWindows ( ) ;
926+ getLogger ( ) . debug ( 'Quit called with %d window(s) open' , windows . length ) ;
927+ if ( windows . length > 0 ) {
928+ for ( const window of windows ) {
929+ // Only send the start-app-quit message to full-fledged project windows.
930+ // Any other windows aren't listening for the start-app-quit message
931+ // and therefore, will never respond with window-app-close message.
932+ //
933+ if ( Object . prototype . hasOwnProperty . call ( window , 'isReady' ) ) {
934+ getLogger ( ) . debug ( 'sending start-app-quit to window id %d' , window . id ) ;
935+ sendToWindow ( window , 'start-app-quit' ) ;
936+ } else {
937+ getLogger ( ) . debug ( 'skipping start-app-close message for window id %d' , window . id ) ;
938+ window . close ( ) ;
939+ }
940+ }
941+ } else {
942+ // If Quit is called with no open windows, just quit. This handles the case where,
943+ // on MacOS, the About Window is the last window open. It is a special dialog window
944+ // that is not included in the BrowserWindow.getAllWindows()...
945+ //
946+ app . quit ( ) ;
927947 }
928948}
929949
@@ -1047,18 +1067,6 @@ async function promptUserForOkOrCancelAnswer(targetWindow, title, message) {
10471067 } ) ;
10481068}
10491069
1050- function getCheckForAppUpdatesMenuItem ( ) {
1051- let checkForAppUpdatesMenuItem ;
1052- const menu = Menu . getApplicationMenu ( ) ;
1053- if ( menu ) {
1054- const helpMenu = menu . items . find ( item => item . id === 'help' ) ;
1055- if ( helpMenu && helpMenu . submenu ) {
1056- checkForAppUpdatesMenuItem = helpMenu . submenu . items . find ( item => item . id === 'checkForAppUpdates' ) ;
1057- }
1058- }
1059- return checkForAppUpdatesMenuItem ;
1060- }
1061-
10621070// Arguments added here should be passed to the browser's window.process.argv array.
10631071function _getAdditionalArguments ( ) {
10641072 let extraArgs = [ ] ;
@@ -1081,7 +1089,6 @@ module.exports = {
10811089 closeWindow,
10821090 createNetworkWindow,
10831091 createWindow,
1084- getCheckForAppUpdatesMenuItem,
10851092 initialize,
10861093 isSingleWindow,
10871094 setTitleFileName,
0 commit comments