mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
clear pointer when WebContents is closed
This commit is contained in:
@@ -63,12 +63,15 @@ WebContentsView::WebContentsView(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
WebContentsView::~WebContentsView() {
|
||||
api_web_contents_->RemoveObserver(this);
|
||||
api_web_contents_->DestroyWebContents(false /* async */);
|
||||
if (api_web_contents_) {
|
||||
api_web_contents_->RemoveObserver(this);
|
||||
api_web_contents_->DestroyWebContents(false /* async */);
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentsView::OnCloseContents() {
|
||||
// TODO(zcbenz): WebContents is closed, report the event.
|
||||
api_web_contents_ = nullptr;
|
||||
web_contents_.Reset();
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
Reference in New Issue
Block a user