]> khamidou — GitHub mirrors - electron.git/commitdiff
Make sure the 'closed' event is emitted before 'window-all-closed'.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 7 May 2013 08:20:52 +0000 (16:20 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 7 May 2013 08:20:52 +0000 (16:20 +0800)
browser/default_app/main.js
browser/native_window.cc

index e8daddefc1737f5508bcae726c761791452d004f..50807df33c57a41153de350ed207f30b1ec3a3ef 100644 (file)
@@ -28,4 +28,9 @@ atom.browserMainParts.preMainMessageLoopRun = function() {
 
     this.setTitle('Atom Shell - ' + title);
   });
+
+  mainWindow.on('closed', function() {
+    console.log('closed');
+    mainWindow = null;
+  });
 }
index cbea4a75fb74587b058e463c38757434a6e83328..179a6aad3c9b6b35b068cee8f8935778928c1d10 100644 (file)
@@ -157,9 +157,9 @@ void NativeWindow::NotifyWindowClosed() {
     return;
 
   is_closed_ = true;
-  WindowList::RemoveWindow(this);
-
   FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowClosed());
+
+  WindowList::RemoveWindow(this);
 }
 
 // Window opened by window.open.