Index: base/task.h |
=================================================================== |
--- base/task.h (revision 32148) |
+++ base/task.h (working copy) |
@@ -221,7 +221,14 @@ |
} |
void RetainCallee(T* obj) { |
+#ifndef NDEBUG |
+ // Catch NewRunnableMethod being called in an object's constructor. This |
+ // isn't safe since the method can be invoked before the constructor |
+ // completes, causing the object to be deleted. |
obj->AddRef(); |
+ obj->Release(); |
+#endif |
+ obj->AddRef(); |
} |
void ReleaseCallee(T* obj) { |