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

Unified Diff: base/callback_internal.cc

Issue 10388060: Make Callback.Reset safe against deleting itself. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 8 years, 6 months 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 | base/callback_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_internal.cc
diff --git a/base/callback_internal.cc b/base/callback_internal.cc
index a483293257e445224c6c6148bc8e7c5a6ff2db58..65fe710a20c7ff25ae041d46c11fdb711277c2ff 100644
--- a/base/callback_internal.cc
+++ b/base/callback_internal.cc
@@ -14,8 +14,10 @@ bool CallbackBase::is_null() const {
}
void CallbackBase::Reset() {
- bind_state_ = NULL;
polymorphic_invoke_ = NULL;
+ // NULL the bind_state_ last, since it may be holding the last ref to whatever
+ // object owns us, and we may be deleted after that.
+ bind_state_ = NULL;
}
bool CallbackBase::Equals(const CallbackBase& other) const {
« no previous file with comments | « no previous file | base/callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698