From 9fd5a64cd8f853d12a6fdf594f3ce3ad278041ab Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 17 Sep 2015 11:25:27 +0800 Subject: [PATCH 1/3] Update brightray to unsubscribe from NSNotificationCenter --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index d385c9b1b88d..f103af2f6bb3 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit d385c9b1b88da3ba1b5426861ec7c63e8c884135 +Subproject commit f103af2f6bb38bb4ceeabd8688d8dee87ccefca1 From e3c64d79716fa40e000827355d3d2d6f744554ee Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 17 Sep 2015 11:30:17 +0800 Subject: [PATCH 2/3] Release the native window after window gets closed Previously we delete the window after the JS object gets garbage collected, which is too late for releasing some resources. --- atom/browser/api/atom_api_window.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 1a76c3e5f078..3503fb4eb0fc 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/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() { From e73c655d653b59f139f02b49c3a6d2224049ce14 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 17 Sep 2015 11:32:19 +0800 Subject: [PATCH 3/3] No need to delete window in Destory The native window is now automatically deleted after it gets closed. --- atom/browser/api/atom_api_window.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 3503fb4eb0fc..4c82ef1fad5f 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -223,10 +223,8 @@ bool Window::IsDestroyed() const { } void Window::Destroy() { - if (window_) { + if (window_) window_->CloseContents(nullptr); - window_.reset(); - } } void Window::Close() {