Detach from devtools before destroying
Otherwise Electron would crash on exit in Chrome 58.
This commit is contained in:
parent
79a441874e
commit
98c039c880
2 changed files with 11 additions and 4 deletions
|
@ -235,9 +235,14 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
InspectableWebContentsImpl::~InspectableWebContentsImpl() {
|
InspectableWebContentsImpl::~InspectableWebContentsImpl() {
|
||||||
if (devtools_web_contents_)
|
// Unsubscribe from devtools and Clean up resources.
|
||||||
devtools_web_contents_->Close();
|
if (devtools_web_contents_) {
|
||||||
Observe(nullptr);
|
devtools_web_contents_->SetDelegate(nullptr);
|
||||||
|
// Calling this also unsubscribes the observer, so WebContentsDestroyed
|
||||||
|
// won't be called again.
|
||||||
|
WebContentsDestroyed();
|
||||||
|
}
|
||||||
|
// Let destructor destroy devtools_web_contents_.
|
||||||
}
|
}
|
||||||
|
|
||||||
InspectableWebContentsView* InspectableWebContentsImpl::GetView() const {
|
InspectableWebContentsView* InspectableWebContentsImpl::GetView() const {
|
||||||
|
@ -651,6 +656,7 @@ void InspectableWebContentsImpl::RenderFrameHostChanged(
|
||||||
|
|
||||||
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||||
frontend_loaded_ = false;
|
frontend_loaded_ = false;
|
||||||
|
Observe(nullptr);
|
||||||
Detach();
|
Detach();
|
||||||
|
|
||||||
for (const auto& pair : pending_requests_)
|
for (const auto& pair : pending_requests_)
|
||||||
|
@ -695,6 +701,7 @@ void InspectableWebContentsImpl::HandleKeyboardEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
|
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
|
||||||
|
// This is where the devtools closes itself (by clicking the x button).
|
||||||
CloseDevTools();
|
CloseDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 8c3e532385811b5cea80e969c1beb1bf3ffb6777
|
Subproject commit 791141a820ecf6166a86249701838b57f43777ea
|
Loading…
Reference in a new issue