зеркало из https://github.com/mozilla/pjs.git
Bug 383553 - Crash on quit in nsTimerImpl::Release, r=dbaron sr=brendan
This commit is contained in:
Родитель
07144d520f
Коммит
ff51038cee
|
@ -74,11 +74,7 @@ TimerThread::~TimerThread()
|
||||||
|
|
||||||
mThread = nsnull;
|
mThread = nsnull;
|
||||||
|
|
||||||
PRInt32 n = mTimers.Count();
|
NS_ASSERTION(mTimers.Count() == 0, "Timers remain in TimerThread::~TimerThread");
|
||||||
while (--n >= 0) {
|
|
||||||
nsTimerImpl *timer = static_cast<nsTimerImpl *>(mTimers[n]);
|
|
||||||
NS_RELEASE(timer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -332,7 +328,7 @@ nsresult TimerThread::AddTimer(nsTimerImpl *aTimer)
|
||||||
// Add the timer to our list.
|
// Add the timer to our list.
|
||||||
PRInt32 i = AddTimerInternal(aTimer);
|
PRInt32 i = AddTimerInternal(aTimer);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// Awaken the timer thread.
|
// Awaken the timer thread.
|
||||||
if (mCondVar && mWaiting && i == 0)
|
if (mCondVar && mWaiting && i == 0)
|
||||||
|
@ -384,6 +380,9 @@ nsresult TimerThread::RemoveTimer(nsTimerImpl *aTimer)
|
||||||
// This function must be called from within a lock
|
// This function must be called from within a lock
|
||||||
PRInt32 TimerThread::AddTimerInternal(nsTimerImpl *aTimer)
|
PRInt32 TimerThread::AddTimerInternal(nsTimerImpl *aTimer)
|
||||||
{
|
{
|
||||||
|
if (mShutdown)
|
||||||
|
return -1;
|
||||||
|
|
||||||
PRIntervalTime now = PR_IntervalNow();
|
PRIntervalTime now = PR_IntervalNow();
|
||||||
PRInt32 count = mTimers.Count();
|
PRInt32 count = mTimers.Count();
|
||||||
PRInt32 i = 0;
|
PRInt32 i = 0;
|
||||||
|
|
|
@ -128,6 +128,7 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void)
|
||||||
if (count == 1 && mArmed) {
|
if (count == 1 && mArmed) {
|
||||||
mCanceled = PR_TRUE;
|
mCanceled = PR_TRUE;
|
||||||
|
|
||||||
|
NS_ASSERTION(gThread, "An armed timer exists after the thread timer stopped.");
|
||||||
if (NS_SUCCEEDED(gThread->RemoveTimer(this)))
|
if (NS_SUCCEEDED(gThread->RemoveTimer(this)))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче