fix: BrowserView
crash when 'beforeunload' prevented (#37205)
fix: crash when beforeunload prevented
This commit is contained in:
parent
4d6f230d21
commit
8eee4f2df1
2 changed files with 4 additions and 2 deletions
|
@ -112,7 +112,6 @@ BrowserWindow::~BrowserWindow() {
|
||||||
api_web_contents_->RemoveObserver(this);
|
api_web_contents_->RemoveObserver(this);
|
||||||
// Destroy the WebContents.
|
// Destroy the WebContents.
|
||||||
OnCloseContents();
|
OnCloseContents();
|
||||||
api_web_contents_->Destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +139,7 @@ void BrowserWindow::WebContentsDestroyed() {
|
||||||
|
|
||||||
void BrowserWindow::OnCloseContents() {
|
void BrowserWindow::OnCloseContents() {
|
||||||
BaseWindow::ResetBrowserViews();
|
BaseWindow::ResetBrowserViews();
|
||||||
|
api_web_contents_->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::OnRendererResponsive(content::RenderProcessHost*) {
|
void BrowserWindow::OnRendererResponsive(content::RenderProcessHost*) {
|
||||||
|
|
|
@ -1222,7 +1222,9 @@ void WebContents::CloseContents(content::WebContents* source) {
|
||||||
for (ExtendedWebContentsObserver& observer : observers_)
|
for (ExtendedWebContentsObserver& observer : observers_)
|
||||||
observer.OnCloseContents();
|
observer.OnCloseContents();
|
||||||
|
|
||||||
Destroy();
|
// If there are observers, OnCloseContents will call Destroy()
|
||||||
|
if (observers_.empty())
|
||||||
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::ActivateContents(content::WebContents* source) {
|
void WebContents::ActivateContents(content::WebContents* source) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue