Index: base/memory/weak_ptr.h |
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h |
index b66f02431aac2aa48bcf9babc396de3d8e055095..f7bf677f1aac2886f569863265413989a1de0ce8 100644 |
--- a/base/memory/weak_ptr.h |
+++ b/base/memory/weak_ptr.h |
@@ -231,23 +231,30 @@ class WeakPtrFactory { |
public: |
explicit WeakPtrFactory(T* ptr) : ptr_(ptr) { |
} |
+ ~WeakPtrFactory(){ |
darin (slow to review)
2012/05/17 22:00:52
nit: add new line above the destructor
oshima
2012/05/17 22:16:43
Done.
|
+ ptr_ = NULL; |
darin (slow to review)
2012/05/17 22:00:52
i wonder... should we null this out only in debug
oshima
2012/05/17 22:16:43
I wanted this to fail on trybots, which is release
|
+ } |
WeakPtr<T> GetWeakPtr() { |
+ DCHECK(ptr_); |
return WeakPtr<T>(weak_reference_owner_.GetRef(), ptr_); |
} |
// Call this method to invalidate all existing weak pointers. |
void InvalidateWeakPtrs() { |
+ DCHECK(ptr_); |
weak_reference_owner_.Invalidate(); |
} |
// Call this method to determine if any weak pointers exist. |
bool HasWeakPtrs() const { |
+ DCHECK(ptr_); |
return weak_reference_owner_.HasRefs(); |
} |
// Indicates that this object will be used on another thread from now on. |
void DetachFromThread() { |
+ DCHECK(ptr_); |
weak_reference_owner_.DetachFromThread(); |
} |