mirror of
https://github.com/electron/electron.git
synced 2026-01-25 23:38:18 -05:00
Make sure window is closed before WebContents is destroyed.
Otherwise we would get "RawChannel fatal error".
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -241,6 +241,7 @@ void NativeWindowMac::Close() {
|
||||
|
||||
void NativeWindowMac::CloseImmediately() {
|
||||
[window_ close];
|
||||
window_.reset();
|
||||
}
|
||||
|
||||
void NativeWindowMac::Move(const gfx::Rect& pos) {
|
||||
|
||||
@@ -137,6 +137,7 @@ void NativeWindowViews::Close() {
|
||||
|
||||
void NativeWindowViews::CloseImmediately() {
|
||||
window_->CloseNow();
|
||||
window_.reset();
|
||||
}
|
||||
|
||||
void NativeWindowViews::Move(const gfx::Rect& bounds) {
|
||||
|
||||
Reference in New Issue
Block a user