Follow up to Bug 135231, fix a crasher due to a double free. r/sr=bienvenu

git-svn-id: svn://10.0.0.236/trunk@236065 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bugzilla%standard8.plus.com 2007-09-16 20:25:56 +00:00
parent 3b96b80942
commit d621f58b11

View File

@ -628,11 +628,18 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::OnQueryResult(PRInt32 aResult,
{
PRUint32 count = mListeners.Count();
// XXX: Temporary fix for crasher needs reviewing as part of bug 135231.
// Temporarily add a reference to ourselves, in case the only thing
// keeping us alive is the link with the listener.
NS_ADDREF_THIS();
for (PRInt32 i = count - 1; i >= 0; --i)
{
mListeners[i]->OnSearchFinished(aResult, EmptyString());
mListeners.RemoveObjectAt(i);
}
NS_RELEASE_THIS();
return NS_OK;
}