diff options
author | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 22:04:50 +0000 |
---|---|---|
committer | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 22:04:50 +0000 |
commit | 48c0e6c35dd40689f25809716c8722f8772007a1 (patch) | |
tree | c2ccd98c4e49ebd5a71eb4c8b43d0d8b739b379e /net/proxy | |
parent | 7ef2097ca809caf534b8a85e3ffa93c741f168db (diff) | |
download | chromium_src-48c0e6c35dd40689f25809716c8722f8772007a1.zip chromium_src-48c0e6c35dd40689f25809716c8722f8772007a1.tar.gz chromium_src-48c0e6c35dd40689f25809716c8722f8772007a1.tar.bz2 |
Fix a crash-on-shutdown in ProxyConfigServiceMac
by ensuring the config watcher thread is stopped/joined
while its owner is still alive.
BUG=97260
Review URL: http://codereview.chromium.org/7980016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_config_service_mac.cc | 6 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_mac.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index ffc9c77..df26466 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -187,17 +187,19 @@ class ProxyConfigServiceMac::Helper ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) : forwarder_(this), - config_watcher_(&forwarder_), has_fetched_config_(false), helper_(new Helper(this)), io_loop_(io_loop) { DCHECK(io_loop); + config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); } ProxyConfigServiceMac::~ProxyConfigServiceMac() { DCHECK_EQ(io_loop_, MessageLoop::current()); + // Delete the config_watcher_ to ensure the notifier thread finishes before + // this object is destroyed. + config_watcher_.reset(); helper_->Orphan(); - io_loop_ = NULL; } void ProxyConfigServiceMac::AddObserver(Observer* observer) { diff --git a/net/proxy/proxy_config_service_mac.h b/net/proxy/proxy_config_service_mac.h index ea22579..493e6a2 100644 --- a/net/proxy/proxy_config_service_mac.h +++ b/net/proxy/proxy_config_service_mac.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "net/base/network_config_watcher_mac.h" #include "net/proxy/proxy_config.h" @@ -62,7 +63,7 @@ class ProxyConfigServiceMac : public ProxyConfigService { void OnProxyConfigChanged(const ProxyConfig& new_config); Forwarder forwarder_; - const NetworkConfigWatcherMac config_watcher_; + scoped_ptr<const NetworkConfigWatcherMac> config_watcher_; ObserverList<Observer> observers_; |