clear pointer when WebContents is closed

This commit is contained in:
Cheng Zhao 2018-05-18 16:31:43 +09:00
parent 51db1efb8a
commit 3b81312cf7

View file

@ -63,12 +63,15 @@ WebContentsView::WebContentsView(v8::Isolate* isolate,
} }
WebContentsView::~WebContentsView() { WebContentsView::~WebContentsView() {
if (api_web_contents_) {
api_web_contents_->RemoveObserver(this); api_web_contents_->RemoveObserver(this);
api_web_contents_->DestroyWebContents(false /* async */); api_web_contents_->DestroyWebContents(false /* async */);
} }
}
void WebContentsView::OnCloseContents() { void WebContentsView::OnCloseContents() {
// TODO(zcbenz): WebContents is closed, report the event. api_web_contents_ = nullptr;
web_contents_.Reset();
} }
// static // static