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
Родитель 4a33d14311
Коммит d92ea91a17
2 изменённых файлов: 4 добавлений и 5 удалений

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

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

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

@ -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;
}