Bug 976171 - crash in mozilla::net::CacheIOThread::LoopOneLevel(unsigned int), r=michal

This commit is contained in:
Honza Bambas 2014-05-02 20:15:15 +02:00
parent 9a6e8306aa
commit 39cdf6c4cb

View File

@ -56,6 +56,9 @@ nsresult CacheIOThread::Dispatch(nsIRunnable* aRunnable, uint32_t aLevel)
{
NS_ENSURE_ARG(aLevel < LAST_LEVEL);
// Runnable is always expected to be non-null, hard null-check bellow.
MOZ_ASSERT(aRunnable);
MonitorAutoLock lock(mMonitor);
if (mShutdown && (PR_GetCurrentThread() != mThread))
@ -66,6 +69,9 @@ nsresult CacheIOThread::Dispatch(nsIRunnable* aRunnable, uint32_t aLevel)
nsresult CacheIOThread::DispatchAfterPendingOpens(nsIRunnable* aRunnable)
{
// Runnable is always expected to be non-null, hard null-check bellow.
MOZ_ASSERT(aRunnable);
MonitorAutoLock lock(mMonitor);
if (mShutdown && (PR_GetCurrentThread() != mThread))
@ -81,6 +87,9 @@ nsresult CacheIOThread::DispatchAfterPendingOpens(nsIRunnable* aRunnable)
nsresult CacheIOThread::DispatchInternal(nsIRunnable* aRunnable, uint32_t aLevel)
{
if (NS_WARN_IF(!aRunnable))
return NS_ERROR_NULL_POINTER;
mMonitor.AssertCurrentThreadOwns();
mEventQueue[aLevel].AppendElement(aRunnable);