Fix quitAndInstall when there is no window.
This commit is contained in:
parent
b932461b45
commit
a9efe77ceb
1 changed files with 8 additions and 2 deletions
|
@ -9,6 +9,13 @@ autoUpdater.on 'update-downloaded-raw', (args...) ->
|
||||||
@emit 'update-downloaded', args..., => @quitAndInstall()
|
@emit 'update-downloaded', args..., => @quitAndInstall()
|
||||||
|
|
||||||
autoUpdater.quitAndInstall = ->
|
autoUpdater.quitAndInstall = ->
|
||||||
|
# If we don't have any window then quitAndInstall immediately.
|
||||||
|
BrowserWindow = require 'browser-window'
|
||||||
|
windows = BrowserWindow.getAllWindows()
|
||||||
|
if windows.length is 0
|
||||||
|
AutoUpdater::quitAndInstall.call this
|
||||||
|
return
|
||||||
|
|
||||||
# Do the restart after all windows have been closed.
|
# Do the restart after all windows have been closed.
|
||||||
app = require 'app'
|
app = require 'app'
|
||||||
app.removeAllListeners 'window-all-closed'
|
app.removeAllListeners 'window-all-closed'
|
||||||
|
@ -16,7 +23,6 @@ autoUpdater.quitAndInstall = ->
|
||||||
|
|
||||||
# Tell all windows to remove beforeunload handler and then close itself.
|
# Tell all windows to remove beforeunload handler and then close itself.
|
||||||
ipc = require 'ipc'
|
ipc = require 'ipc'
|
||||||
BrowserWindow = require 'browser-window'
|
ipc.sendChannel win.getProcessId(), win.getRoutingId(), 'ATOM_SHELL_SILENT_CLOSE' for win in windows
|
||||||
ipc.sendChannel win.getProcessId(), win.getRoutingId(), 'ATOM_SHELL_SILENT_CLOSE' for win in BrowserWindow.getAllWindows()
|
|
||||||
|
|
||||||
module.exports = autoUpdater
|
module.exports = autoUpdater
|
||||||
|
|
Loading…
Reference in a new issue