From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 20 Jul 2020 14:02:56 -0700 Subject: fix: missing WeakPtr check in PreconnectManager https://chromium-review.googlesource.com/c/chromium/src/+/2295780 added UKM around prefetch accuracy stats, which involved an added line in PreconnectManager::TryToLaunchPreresolveJobs() that did not check the WeakPtr before using it. This fixes that. Upstreamed at: https://chromium-review.googlesource.com/c/chromium/src/+/2309029 diff --git a/chrome/browser/predictors/preconnect_manager.cc b/chrome/browser/predictors/preconnect_manager.cc index 78216f0083281b4f1e0209f766753d0dc9c796c4..bd81f631b15cc4cb8c54afd51bd8739f4256ae33 100644 --- a/chrome/browser/predictors/preconnect_manager.cc +++ b/chrome/browser/predictors/preconnect_manager.cc @@ -231,7 +231,8 @@ void PreconnectManager::TryToLaunchPreresolveJobs() { weak_factory_.GetWeakPtr(), job_id)); if (info) { ++info->inflight_count; - delegate_->PreconnectInitiated(info->url, job->url); + if (delegate_) + delegate_->PreconnectInitiated(info->url, job->url); } ++inflight_preresolves_count_; } else {