Commit e6516e15 authored by John Abd-El-Malek's avatar John Abd-El-Malek

Fix network service crash on shutdown if it's not initialized.

Bug: 937803
Change-Id: I68cc01cf8c2a6f5bd5232f2c3f4296352ef181d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1507193
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarRobbie McElrath <rmcelrath@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638384}
parent 6946c0cd
......@@ -335,7 +335,9 @@ NetworkService::~NetworkService() {
file_net_log_observer_->StopObserving(nullptr /*polled_data*/,
base::OnceClosure());
}
trace_net_log_observer_.StopWatchForTraceStart();
if (initialized_)
trace_net_log_observer_.StopWatchForTraceStart();
}
void NetworkService::set_os_crypt_is_configured() {
......@@ -707,8 +709,10 @@ void NetworkService::DestroyNetworkContexts() {
// The SetDnsConfigOverrides() call will will fail any in-progress DNS
// lookups, but only if there are current config overrides (which there will
// be if DNS over HTTPS is currently enabled).
host_resolver_->SetDnsConfigOverrides(net::DnsConfigOverrides());
host_resolver_->SetRequestContext(nullptr);
if (host_resolver_) {
host_resolver_->SetDnsConfigOverrides(net::DnsConfigOverrides());
host_resolver_->SetRequestContext(nullptr);
}
DCHECK_LE(owned_network_contexts_.size(), 1u);
owned_network_contexts_.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment