Bug 1870423 - Take always ownership of aRunnable in RemoteLazyInputStreamThread::Dispatch. r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D196765
This commit is contained in:
Jens Stutte 2023-12-19 07:37:58 +00:00
Родитель 19afffc44c
Коммит 9fc1a8a71a
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -147,12 +147,15 @@ RemoteLazyInputStreamThread::IsOnCurrentThread(bool* aRetval) {
NS_IMETHODIMP
RemoteLazyInputStreamThread::Dispatch(already_AddRefed<nsIRunnable> aRunnable,
uint32_t aFlags) {
nsCOMPtr<nsIRunnable> runnable(aRunnable);
if (RLISThreadIsInOrBeyondShutdown()) {
// nsIEventTarget::Dispatch must leak the runnable if the dispatch fails.
(void)runnable.forget();
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
nsCOMPtr<nsIRunnable> runnable(aRunnable);
StaticMutexAutoLock lock(gRemoteLazyThreadMutex);
return mThread->Dispatch(runnable.forget(), aFlags);