Bug 984708 - Make sure we clear out the shutdown timer no matter what. r=bent

This commit is contained in:
Blake Kaplan 2014-03-19 10:36:28 -04:00
Родитель 343d4e1ea6
Коммит b356dfdf64
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -980,6 +980,7 @@ ParentImpl::ShutdownBackgroundThread()
AssertIsOnMainThread();
MOZ_ASSERT_IF(!sBackgroundThread, !sBackgroundThreadMessageLoop);
MOZ_ASSERT_IF(!sShutdownHasStarted, !sLiveActorCount);
MOZ_ASSERT_IF(!sBackgroundThread, !sLiveActorCount);
MOZ_ASSERT_IF(sBackgroundThread, sShutdownTimer);
if (sPendingCallbacks) {
@ -1001,6 +1002,12 @@ ParentImpl::ShutdownBackgroundThread()
}
}
nsCOMPtr<nsITimer> shutdownTimer;
if (sShutdownHasStarted) {
shutdownTimer = sShutdownTimer.get();
sShutdownTimer = nullptr;
}
if (sBackgroundThread) {
nsCOMPtr<nsIThread> thread = sBackgroundThread.get();
nsAutoPtr<nsTArray<ParentImpl*>> liveActors(sLiveActorsForBackgroundThread);
@ -1015,8 +1022,6 @@ ParentImpl::ShutdownBackgroundThread()
// If this is final shutdown then we need to spin the event loop while we
// wait for all the actors to be cleaned up. We also set a timeout to
// force-kill any hanging actors.
nsCOMPtr<nsITimer> shutdownTimer = sShutdownTimer.get();
sShutdownTimer = nullptr;
if (sLiveActorCount) {
TimerCallbackClosure closure(thread, liveActors);