Bug 316569, Memory leak in XTF when using nsXTFInterfaceAggregator, r+sr=bryner

This commit is contained in:
Olli.Pettay%helsinki.fi 2005-11-17 21:16:12 +00:00
parent f2d4eacd78
commit a41b6a076e
2 changed files with 18 additions and 14 deletions

View File

@ -208,14 +208,16 @@ nsXTFBindableElementWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
// try to get get the interface from our wrapped element:
void *innerPtr = nsnull;
QueryInterfaceInner(aIID, &innerPtr);
nsCOMPtr<nsISupports> inner;
QueryInterfaceInner(aIID, getter_AddRefs(inner));
if (innerPtr)
return NS_NewXTFInterfaceAggregator(aIID,
NS_STATIC_CAST(nsISupports*, innerPtr),
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
if (inner) {
rv = NS_NewXTFInterfaceAggregator(aIID, inner,
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
return rv;
}
return NS_ERROR_NO_INTERFACE;
}

View File

@ -102,14 +102,16 @@ nsXTFElementWrapper::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
else {
// try to get get the interface from our wrapped element:
void *innerPtr = nsnull;
QueryInterfaceInner(aIID, &innerPtr);
nsCOMPtr<nsISupports> inner;
QueryInterfaceInner(aIID, getter_AddRefs(inner));
if (innerPtr)
return NS_NewXTFInterfaceAggregator(aIID,
NS_STATIC_CAST(nsISupports*, innerPtr),
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
if (inner) {
rv = NS_NewXTFInterfaceAggregator(aIID, inner,
NS_STATIC_CAST(nsIContent*, this),
aInstancePtr);
return rv;
}
}
return NS_ERROR_NO_INTERFACE;