From b1e9fd1a45707143d1791a0ce632bc152e30b113 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 7 Jun 2019 16:02:28 +0200 Subject: [PATCH] fix: crash in BrowserWindow destructor after win.webContents.destroy() --- atom/browser/api/atom_api_browser_window.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index 5a429e9a1e31f..2e13df72971d0 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -94,11 +94,12 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate, } BrowserWindow::~BrowserWindow() { - api_web_contents_->RemoveObserver(this); // Note that the OnWindowClosed will not be called after the destructor runs, // since the window object is managed by the TopLevelWindow class. - if (web_contents()) + if (web_contents()) { + api_web_contents_->RemoveObserver(this); Cleanup(); + } } void BrowserWindow::OnInputEvent(const blink::WebInputEvent& event) {