]> khamidou — GitHub mirrors - electron.git/commitdiff
Make sure window is closed before WebContents is destroyed.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 28 Jul 2014 09:34:21 +0000 (17:34 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 28 Jul 2014 12:28:51 +0000 (20:28 +0800)
Otherwise we would get "RawChannel fatal error".

atom/browser/native_window.cc
atom/browser/native_window_mac.mm
atom/browser/native_window_views.cc

index 4be4ac694124c07321b215c91a8a6f9d2d1d049f..5481bfa1d67c79c381677349b2c7f97339288b84 100644 (file)
@@ -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
index e16aabdc93a5a4b1121a8f51915d40a57520b028..804595edbcfc06f69d35fe8417810c20c6433beb 100644 (file)
@@ -241,6 +241,7 @@ void NativeWindowMac::Close() {
 
 void NativeWindowMac::CloseImmediately() {
   [window_ close];
+  window_.reset();
 }
 
 void NativeWindowMac::Move(const gfx::Rect& pos) {
index 4c99a56389fcdbaaa8cdb0fefa9214bc4db0c6dd..89665c68d56a479306f94e947899539f9d767e67 100644 (file)
@@ -137,6 +137,7 @@ void NativeWindowViews::Close() {
 
 void NativeWindowViews::CloseImmediately() {
   window_->CloseNow();
+  window_.reset();
 }
 
 void NativeWindowViews::Move(const gfx::Rect& bounds) {