Bug 1135773 - Initialize QI return values to null in the cycle collector. r=smaug

This commit is contained in:
Andrew McCreight
2015-02-25 09:44:10 -08:00
parent 9f1c486642
commit c3eadcc50d

View File

@@ -914,7 +914,7 @@ CCGraph::RemoveNodeFromMap(void* aPtr)
static nsISupports*
CanonicalizeXPCOMParticipant(nsISupports* aIn)
{
nsISupports* out;
nsISupports* out = nullptr;
aIn->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
reinterpret_cast<void**>(&out));
return out;
@@ -1409,6 +1409,7 @@ ToParticipant(nsISupports* aPtr, nsXPCOMCycleCollectionParticipant** aCp)
// nsXPCOMCycleCollectionParticipant, which is a per-class singleton helper
// object that implements traversal and unlinking logic for the nsISupports
// in question.
*aCp = nullptr;
CallQueryInterface(aPtr, aCp);
}
@@ -3928,7 +3929,7 @@ HoldJSObjectsImpl(void* aHolder, nsScriptObjectTracer* aTracer)
void
HoldJSObjectsImpl(nsISupports* aHolder)
{
nsXPCOMCycleCollectionParticipant* participant;
nsXPCOMCycleCollectionParticipant* participant = nullptr;
CallQueryInterface(aHolder, &participant);
MOZ_ASSERT(participant, "Failed to QI to nsXPCOMCycleCollectionParticipant!");
MOZ_ASSERT(participant->CheckForRightISupports(aHolder),
@@ -3955,7 +3956,7 @@ void
DropJSObjectsImpl(nsISupports* aHolder)
{
#ifdef DEBUG
nsXPCOMCycleCollectionParticipant* participant;
nsXPCOMCycleCollectionParticipant* participant = nullptr;
CallQueryInterface(aHolder, &participant);
MOZ_ASSERT(participant, "Failed to QI to nsXPCOMCycleCollectionParticipant!");
MOZ_ASSERT(participant->CheckForRightISupports(aHolder),