Index: base/memory/weak_ptr.h |
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h |
index b66f02431aac2aa48bcf9babc396de3d8e055095..b7d0490f087c7880e6472e5a7a0c5da7bd896de3 100644 |
--- a/base/memory/weak_ptr.h |
+++ b/base/memory/weak_ptr.h |
@@ -232,22 +232,30 @@ class WeakPtrFactory { |
explicit WeakPtrFactory(T* ptr) : ptr_(ptr) { |
} |
+ ~WeakPtrFactory() { |
+ ptr_ = NULL; |
+ } |
+ |
WeakPtr<T> GetWeakPtr() { |
+ CHECK(ptr_); |
darin (slow to review)
2012/05/18 17:45:13
I think it is a bit bloaty to inline this into eve
|
return WeakPtr<T>(weak_reference_owner_.GetRef(), ptr_); |
} |
// Call this method to invalidate all existing weak pointers. |
void InvalidateWeakPtrs() { |
+ CHECK(ptr_); |
weak_reference_owner_.Invalidate(); |
} |
// Call this method to determine if any weak pointers exist. |
bool HasWeakPtrs() const { |
+ CHECK(ptr_); |
return weak_reference_owner_.HasRefs(); |
} |
// Indicates that this object will be used on another thread from now on. |
void DetachFromThread() { |
+ CHECK(ptr_); |
weak_reference_owner_.DetachFromThread(); |
} |