fix: use-after-free in ElectronBrowserContext during shutdown (#26680)

This commit is contained in:
Jeremy Rose 2020-11-25 12:29:26 -08:00 committed by GitHub
parent 662077f153
commit ba629e3127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -535,7 +535,11 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
node::Stop(node_env_->env());
node_env_.reset();
auto default_context_key = ElectronBrowserContext::PartitionKey("", false);
std::unique_ptr<ElectronBrowserContext> default_context = std::move(
ElectronBrowserContext::browser_context_map()[default_context_key]);
ElectronBrowserContext::browser_context_map().clear();
default_context.reset();
fake_browser_process_->PostMainMessageLoopRun();
content::DevToolsAgentHost::StopRemoteDebuggingPipeHandler();