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

Unified Diff: base/timer/timer.h

Issue 2624133004: Fix use-after-free in base::Timer::StopAndAbandon() (Closed)
Patch Set: Merge branch 'master' into timer_bug Created 3 years, 11 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/timer/timer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/timer/timer.h
diff --git a/base/timer/timer.h b/base/timer/timer.h
index 50aedbd4cec28e97c408b2acd8b896c70526732c..8aac279def647771f7cead12876c2ea06e4fddcf 100644
--- a/base/timer/timer.h
+++ b/base/timer/timer.h
@@ -163,8 +163,10 @@ class BASE_EXPORT Timer {
// Stop running task (if any) and abandon scheduled task (if any).
void StopAndAbandon() {
- Stop();
AbandonScheduledTask();
+
+ Stop();
+ // No more member accesses here: |this| could be deleted at this point.
}
// When non-NULL, the scheduled_task_ is waiting in the MessageLoop to call
« no previous file with comments | « no previous file | base/timer/timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698