author | JW Wang <jwwang@mozilla.com> |
Thu, 10 Jul 2014 11:23:02 -0400 | |
changeset 193391 | 2f00e114a4894d78cecd54b8e064fd5c057396e3 |
parent 193390 | ab6ad70d1a3effbf6faaa4e88e31dcdf05117973 |
child 193392 | df6ba75a47bdc5f1e460d9e9079f92374e776e52 |
push id | 27117 |
push user | ryanvm@gmail.com |
push date | Thu, 10 Jul 2014 22:23:14 +0000 |
treeherder | mozilla-central@e1a037c085d1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 1033121 |
milestone | 33.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -704,16 +704,21 @@ nsTimerEvent::Run() TimeStamp now = TimeStamp::Now(); PR_LOG(GetTimerLog(), PR_LOG_DEBUG, ("[this=%p] time between PostTimerEvent() and Fire(): %fms\n", this, (now - mInitTime).ToMilliseconds())); } #endif mTimer->Fire(); + // Since nsTimerImpl is not thread-safe, we should release |mTimer| + // here in the target thread to avoid race condition. Otherwise, + // ~nsTimerEvent() which calls nsTimerImpl::Release() could run in the + // timer thread and result in race condition. + mTimer = nullptr; return NS_OK; } already_AddRefed<nsTimerImpl> nsTimerImpl::PostTimerEvent(already_AddRefed<nsTimerImpl> aTimerRef) { nsRefPtr<nsTimerImpl> timer(aTimerRef);