Move AddRef to before the unlock. (Bug 650674, patch 2) r=bsmedberg

This commit is contained in:
L. David Baron 2011-04-20 14:29:45 -07:00
Родитель a64eb88ab7
Коммит 73a9b73b12
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -475,6 +475,9 @@ nsProxyObject::LockedFind(REFNSIID aIID, void **aResult)
// linked-list check. // linked-list check.
for (peo = mFirst; peo; peo = peo->mNext) { for (peo = mFirst; peo; peo = peo->mNext) {
if (peo->GetClass()->GetProxiedIID().Equals(aIID)) { if (peo->GetClass()->GetProxiedIID().Equals(aIID)) {
// Best to AddRef for our caller before unlocking.
peo->LockedAddRef();
{ {
// Deleting an nsProxyEventObject can call Release on an // Deleting an nsProxyEventObject can call Release on an
// nsProxyObject, which can only happen when not holding // nsProxyObject, which can only happen when not holding
@ -483,7 +486,6 @@ nsProxyObject::LockedFind(REFNSIID aIID, void **aResult)
delete newpeo; delete newpeo;
} }
*aResult = static_cast<nsISupports*>(peo->mXPTCStub); *aResult = static_cast<nsISupports*>(peo->mXPTCStub);
peo->LockedAddRef();
return NS_OK; return NS_OK;
} }
} }