diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 4be4ac694124..5481bfa1d67c 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -104,10 +104,6 @@ NativeWindow::NativeWindow(content::WebContents* web_contents, } NativeWindow::~NativeWindow() { - // Make sure we have the OnRenderViewDeleted message sent even when the window - // is destroyed directly. - DestroyWebContents(); - // It's possible that the windows gets destroyed before it's closed, in that // case we need to ensure the OnWindowClosed message is still notified. NotifyWindowClosed(); @@ -453,9 +449,6 @@ void NativeWindow::MoveContents(content::WebContents* source, } void NativeWindow::CloseContents(content::WebContents* source) { - // Destroy the WebContents before we close the window. - DestroyWebContents(); - // When the web contents is gone, close the window immediately, but the // memory will not be freed until you call delete. // In this way, it would be safe to manage windows via smart pointers. If you diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index e16aabdc93a5..804595edbcfc 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -241,6 +241,7 @@ void NativeWindowMac::Close() { void NativeWindowMac::CloseImmediately() { [window_ close]; + window_.reset(); } void NativeWindowMac::Move(const gfx::Rect& pos) { diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 4c99a56389fc..89665c68d56a 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -137,6 +137,7 @@ void NativeWindowViews::Close() { void NativeWindowViews::CloseImmediately() { window_->CloseNow(); + window_.reset(); } void NativeWindowViews::Move(const gfx::Rect& bounds) {