refactor: cleanup how WebContents is destroyed (#27920)
This commit is contained in:
parent
b3a0743121
commit
f4e1a343b9
12 changed files with 131 additions and 235 deletions
|
@ -100,11 +100,9 @@ BrowserView::BrowserView(gin::Arguments* args,
|
|||
}
|
||||
|
||||
BrowserView::~BrowserView() {
|
||||
if (api_web_contents_) { // destroy() is called
|
||||
// Destroy WebContents asynchronously unless app is shutting down,
|
||||
// because destroy() might be called inside WebContents's event handler.
|
||||
if (api_web_contents_) { // destroy() called without closing WebContents
|
||||
api_web_contents_->RemoveObserver(this);
|
||||
api_web_contents_->DestroyWebContents(!Browser::Get()->is_shutting_down());
|
||||
api_web_contents_->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue