зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155059: Patch 8 - Don't leak runnables when MediaCache/FileBlockCache get shut down after XPCOM is in final shutdown r=cpearce
This commit is contained in:
Родитель
5211d5e9ad
Коммит
d6a4cd77f2
|
@ -74,9 +74,16 @@ void FileBlockCache::Close()
|
|||
// opening more streams, while the media cache is shutting down and
|
||||
// releasing memory etc! Also note we close mFD in the destructor so
|
||||
// as to not disturb any IO that's currently running.
|
||||
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
||||
if (mainThread) {
|
||||
nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(mThread);
|
||||
mThread = nullptr;
|
||||
NS_DispatchToMainThread(event);
|
||||
mainThread->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
|
||||
} else {
|
||||
// we're on Mainthread already, *and* the event queues are already
|
||||
// shut down, so no events should occur - certainly not creations of
|
||||
// new streams.
|
||||
mThread->Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1409,8 +1409,14 @@ MediaCache::QueueUpdate()
|
|||
if (mUpdateQueued)
|
||||
return;
|
||||
mUpdateQueued = true;
|
||||
// XXX MediaCache does updates when decoders are still running at
|
||||
// shutdown and get freed in the final cycle-collector cleanup. So
|
||||
// don't leak a runnable in that case.
|
||||
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
||||
if (mainThread) {
|
||||
nsCOMPtr<nsIRunnable> event = new UpdateEvent();
|
||||
NS_DispatchToMainThread(event);
|
||||
mainThread->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче