Skip to content

Commit

Permalink
fix: prevent double-destroy of window (#16478)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and codebytere committed Jan 22, 2019
1 parent 89ea210 commit e7d7cc3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion atom/browser/api/atom_api_browser_window.cc
Expand Up @@ -185,7 +185,14 @@ bool BrowserWindow::OnMessageReceived(const IPC::Message& message,
}

void BrowserWindow::OnCloseContents() {
DCHECK(web_contents());
// On some machines it may happen that the window gets destroyed for twice,
// checking web_contents() can effectively guard against that.
// https://github.com/electron/electron/issues/16202.
//
// TODO(zcbenz): We should find out the root cause and improve the closing
// procedure of BrowserWindow.
if (!web_contents())
return;

// Close all child windows before closing current window.
v8::Locker locker(isolate());
Expand Down

0 comments on commit e7d7cc3

Please sign in to comment.