Index: base/threading/sequenced_worker_pool.cc |
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc |
index 7679c1532eabf440285006ab951d9c5df4f66198..72bd105f9a2827a892357718a28710dfb6a30e6a 100644 |
--- a/base/threading/sequenced_worker_pool.cc |
+++ b/base/threading/sequenced_worker_pool.cc |
@@ -45,8 +45,8 @@ struct SequencedTask { |
class SequencedWorkerPool::Worker : public SimpleThread { |
public: |
- // Hold a ref to |worker_pool|, since we want to keep it around even |
- // if it doesn't join our thread. Note that this (deliberately) |
+ // Hold a (cyclic) ref to |worker_pool|, since we want to keep it |
+ // around as long as we are running. Note that this (deliberately) |
brettw
2012/02/28 04:38:46
Is the leaks on shutdown comment still valid? If s
akalin
2012/02/28 22:10:33
Done.
|
// leaks on shutdown. |
Worker(const scoped_refptr<SequencedWorkerPool>& worker_pool, |
int thread_number, |
@@ -57,7 +57,7 @@ class SequencedWorkerPool::Worker : public SimpleThread { |
virtual void Run() OVERRIDE; |
private: |
- const scoped_refptr<SequencedWorkerPool> worker_pool_; |
+ scoped_refptr<SequencedWorkerPool> worker_pool_; |
DISALLOW_COPY_AND_ASSIGN(Worker); |
}; |
@@ -226,6 +226,8 @@ void SequencedWorkerPool::Worker::Run() { |
// having these worker objects at all, but that method lacks the ability to |
// send thread-specific information easily to the thread loop. |
worker_pool_->inner_->ThreadLoop(this); |
+ // Release our cyclic reference once we're done. |
+ worker_pool_ = NULL; |
} |
// Inner definitions --------------------------------------------------------- |