Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: chrome/browser/chromeos/proxy_config_service_impl.cc

Issue 1562593002: Fix potential crashes in NetworkHandler code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test
Patch Set: IsShuttingDown -> OnShuttingDown Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/proxy_config_service_impl.cc
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc
index 4e63069a79562f6c5f95e8ff7b207f68ec309155..6e07ba70cbe2ab19f24d75b078e88c488a2211b5 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.cc
+++ b/chrome/browser/chromeos/proxy_config_service_impl.cc
@@ -117,6 +117,13 @@ void ProxyConfigServiceImpl::DefaultNetworkChanged(
DetermineEffectiveConfigFromDefaultNetwork();
}
+void ProxyConfigServiceImpl::OnShuttingDown() {
+ // Ownership of this class is complicated. Stop observing NetworkStateHandler
+ // when the class shuts down.
+ NetworkHandler::Get()->network_state_handler()->RemoveObserver(this,
+ FROM_HERE);
+}
+
// static
bool ProxyConfigServiceImpl::IgnoreProxy(const PrefService* profile_prefs,
const std::string network_profile_path,
@@ -167,6 +174,9 @@ bool ProxyConfigServiceImpl::IgnoreProxy(const PrefService* profile_prefs,
}
void ProxyConfigServiceImpl::DetermineEffectiveConfigFromDefaultNetwork() {
+ if (!NetworkHandler::IsInitialized())
+ return;
+
NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
const NetworkState* network = handler->DefaultNetwork();

Powered by Google App Engine
This is Rietveld 408576698