]> khamidou — GitHub mirrors - electron.git/commitdiff
Fixes auto updater regression, closes atom/atom#1949.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 7 May 2014 03:32:06 +0000 (11:32 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 7 May 2014 03:32:06 +0000 (11:32 +0800)
atom/browser/api/atom_api_auto_updater.cc
atom/browser/api/lib/auto-updater.coffee

index af85fa104de02a84c48af514cac22ae2f5a3d560..74995a9860c52f5edda7097708b77fec65138bb7 100644 (file)
@@ -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();
 }
 
index ffa0e70af0bfaa7e3790a27ad4a1b9f7f8a4ebea..8b6f7ffd0d30a78b256574a6baa6183d21639747 100644 (file)
@@ -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