Bug 290247: fix 3 long-standing do_CreateInstanceFromCategory bugs:

- initialize mOuter so we don't always try to aggregate against a random
  stack pointer;
- don't try to store through the oft-null mErrorPtr
- set rv so that we actually check CreateInstanceByContractID's return
r=bsmedberg, sr=darin, a=brendan
This commit is contained in:
shaver%mozilla.org 2005-04-13 23:56:54 +00:00
parent 85ab4e49c5
commit 8aae1b4f86
2 changed files with 4 additions and 5 deletions

View File

@ -53,6 +53,7 @@ public:
nsISupports *aOuter, nsresult *aErrorPtr)
: mCategory(aCategory),
mEntry(aEntry),
mOuter(aOuter),
mErrorPtr(aErrorPtr)
{
// nothing else to do;

View File

@ -197,16 +197,14 @@ nsCreateInstanceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr)
NS_GetComponentManager(getter_AddRefs(compMgr));
if (!compMgr)
return NS_ERROR_FAILURE;
compMgr->CreateInstanceByContractID(value,
mOuter,
aIID,
aInstancePtr);
rv = compMgr->CreateInstanceByContractID(value, mOuter, aIID, aInstancePtr);
if (NS_FAILED(rv)) {
error:
*aInstancePtr = 0;
}
*mErrorPtr = rv;
if (mErrorPtr)
*mErrorPtr = rv;
return rv;
}