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 e8dadde..50807df 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 cbea4a7..179a6aa 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.