summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/proxy/proxy_config_service_mac.cc6
-rw-r--r--net/proxy/proxy_config_service_mac.h3
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_;