Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2497)

Unified Diff: base/task.h

Issue 399016: Fix race conditions where an object's constructor uses PostTask on itself. T... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/crx_installer.h » ('j') | views/widget/aero_tooltip_manager.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | chrome/browser/extensions/crx_installer.h » ('j') | views/widget/aero_tooltip_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698