Browse Source

Merge pull request #2815 from atom/release-resources

Release the resources of native window immediately when it is closed
Cheng Zhao 9 years ago
parent
commit
a386bb4edf
2 changed files with 5 additions and 4 deletions
  1. 4 3
      atom/browser/api/atom_api_window.cc
  2. 1 1
      vendor/brightray

+ 4 - 3
atom/browser/api/atom_api_window.cc

@@ -116,6 +116,9 @@ void Window::OnWindowClosed() {
   window_->RemoveObserver(this);
 
   Emit("closed");
+
+  // Clean up the resources after window has been closed.
+  base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release());
 }
 
 void Window::OnWindowBlur() {
@@ -220,10 +223,8 @@ bool Window::IsDestroyed() const {
 }
 
 void Window::Destroy() {
-  if (window_) {
+  if (window_)
     window_->CloseContents(nullptr);
-    window_.reset();
-  }
 }
 
 void Window::Close() {

+ 1 - 1
vendor/brightray

@@ -1 +1 @@
-Subproject commit d385c9b1b88da3ba1b5426861ec7c63e8c884135
+Subproject commit f103af2f6bb38bb4ceeabd8688d8dee87ccefca1