Bug 1476729 - Wrap object in RefPtr. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D2243

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2018-07-19 19:23:16 +00:00
parent ced7192e2f
commit 1b724d418f

View File

@ -102,7 +102,7 @@ SharedThreadPool::Get(const nsCString& aName, uint32_t aThreadLimit)
{
MOZ_ASSERT(sMonitor && sPools);
ReentrantMonitorAutoEnter mon(*sMonitor);
SharedThreadPool* pool = nullptr;
RefPtr<SharedThreadPool> pool;
nsresult rv;
if (auto entry = sPools->LookupForAdd(aName)) {
@ -135,12 +135,10 @@ SharedThreadPool::Get(const nsCString& aName, uint32_t aThreadLimit)
return nullptr;
}
entry.OrInsert([pool] () { return pool; });
entry.OrInsert([pool] () { return pool.get(); });
}
MOZ_ASSERT(pool);
RefPtr<SharedThreadPool> instance(pool);
return instance.forget();
return pool.forget();
}
NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::AddRef(void)