From a69c312389c506cc29d49e69e4d3dabe1a95910c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 7 May 2014 11:32:06 +0800 Subject: [PATCH] Fixes auto updater regression, closes atom/atom#1949. --- atom/browser/api/atom_api_auto_updater.cc | 7 +++++-- atom/browser/api/lib/auto-updater.coffee | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index af85fa104de0..74995a9860c5 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -7,6 +7,7 @@ #include "base/time/time.h" #include "base/values.h" #include "atom/browser/auto_updater.h" +#include "atom/browser/browser.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" @@ -62,11 +63,13 @@ mate::ObjectTemplateBuilder AutoUpdater::GetObjectTemplateBuilder( return mate::ObjectTemplateBuilder(isolate) .SetMethod("setFeedUrl", &auto_updater::AutoUpdater::SetFeedURL) .SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates) - .SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall); + .SetMethod("_quitAndInstall", &AutoUpdater::QuitAndInstall); } void AutoUpdater::QuitAndInstall() { - if (!quit_and_install_.is_null()) + if (quit_and_install_.is_null()) + Browser::Get()->Shutdown(); + else quit_and_install_.Run(); } diff --git a/atom/browser/api/lib/auto-updater.coffee b/atom/browser/api/lib/auto-updater.coffee index ffa0e70af0bf..8b6f7ffd0d30 100644 --- a/atom/browser/api/lib/auto-updater.coffee +++ b/atom/browser/api/lib/auto-updater.coffee @@ -12,13 +12,13 @@ autoUpdater.quitAndInstall = -> BrowserWindow = require 'browser-window' windows = BrowserWindow.getAllWindows() if windows.length is 0 - AutoUpdater::quitAndInstall.call this + @_quitAndInstall() return # Do the restart after all windows have been closed. app = require 'app' app.removeAllListeners 'window-all-closed' - app.once 'window-all-closed', AutoUpdater::quitAndInstall.bind(this) + app.once 'window-all-closed', @_quitAndInstall.bind(this) win.close() for win in windows module.exports = autoUpdater