mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: BrowserView crash when 'beforeunload' prevented (#37268)
fix: crash when beforeunload prevented Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -112,7 +112,6 @@ BrowserWindow::~BrowserWindow() {
|
||||
api_web_contents_->RemoveObserver(this);
|
||||
// Destroy the WebContents.
|
||||
OnCloseContents();
|
||||
api_web_contents_->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +139,7 @@ void BrowserWindow::WebContentsDestroyed() {
|
||||
|
||||
void BrowserWindow::OnCloseContents() {
|
||||
BaseWindow::ResetBrowserViews();
|
||||
api_web_contents_->Destroy();
|
||||
}
|
||||
|
||||
void BrowserWindow::OnRendererResponsive(content::RenderProcessHost*) {
|
||||
|
||||
@@ -1222,7 +1222,9 @@ void WebContents::CloseContents(content::WebContents* source) {
|
||||
for (ExtendedWebContentsObserver& observer : observers_)
|
||||
observer.OnCloseContents();
|
||||
|
||||
Destroy();
|
||||
// If there are observers, OnCloseContents will call Destroy()
|
||||
if (observers_.empty())
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void WebContents::ActivateContents(content::WebContents* source) {
|
||||
|
||||
Reference in New Issue
Block a user