Skip to content

Commit

Permalink
Fix case where webContents is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Dec 15, 2020
1 parent 8b35a4a commit a89cf08
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions shell/browser/api/electron_api_base_window.cc
Expand Up @@ -1081,10 +1081,12 @@ void BaseWindow::ResetBrowserViews() {
!browser_view.IsEmpty()) {
// There's a chance that the BrowserView may have been reparented - only
// reset if the owner window is *this* window.
auto* owner_window = browser_view->web_contents()->owner_window();
if (browser_view->web_contents() && owner_window == window_.get()) {
browser_view->web_contents()->SetOwnerWindow(nullptr);
owner_window->RemoveBrowserView(browser_view->view());
if (browser_view->web_contents()) {
auto* owner_window = browser_view->web_contents()->owner_window();
if (owner_window == window_.get()) {
browser_view->web_contents()->SetOwnerWindow(nullptr);
owner_window->RemoveBrowserView(browser_view->view());
}
}
}

Expand Down

0 comments on commit a89cf08

Please sign in to comment.