fix: check WebContents before emitting render-process-gone event (#27756)

Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
This commit is contained in:
trop[bot]
2021-02-18 10:15:46 +09:00
committed by GitHub
parent b8941d084d
commit d55b399976
2 changed files with 17 additions and 0 deletions

View File

@@ -1390,7 +1390,13 @@ void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
}
void WebContents::RenderProcessGone(base::TerminationStatus status) {
auto weak_this = GetWeakPtr();
Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED);
// User might destroy WebContents in the crashed event.
if (!weak_this)
return;
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope handle_scope(isolate);
gin_helper::Dictionary details = gin_helper::Dictionary::CreateEmpty(isolate);