Index: base/timer/timer.cc |
diff --git a/base/timer/timer.cc b/base/timer/timer.cc |
index abcd70aefa1c31212945b01867e6c039c27a3b9e..1f6efcc7e3db704b60f2740f36e92b277734f1fd 100644 |
--- a/base/timer/timer.cc |
+++ b/base/timer/timer.cc |
@@ -99,8 +99,7 @@ Timer::Timer(const tracked_objects::Location& posted_from, |
} |
Timer::~Timer() { |
- // TODO(gab): Enable this once Stop() properly detaches from sequence. |
- // DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
+ DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
AbandonAndStop(); |
} |
@@ -144,6 +143,10 @@ void Timer::Stop() { |
// DCHECK(origin_sequence_checker_.CalledOnValidSequence()); |
is_running_ = false; |
+ |
+ // It's safe to destroy or restart Timer on another sequence after Stop(). |
+ origin_sequence_checker_.DetachFromSequence(); |
+ |
if (!retain_user_task_) |
user_task_.Reset(); |
// No more member accesses here: |this| could be deleted after freeing |