Don't |delete| interface pointers. Use |AddRef()| and |Release()| instead. Bug #16762, r=pinkerton.

This commit is contained in:
scc%netscape.com 1999-10-26 00:49:33 +00:00
parent 88adb975b9
commit c84b487139
3 changed files with 7 additions and 18 deletions

View File

@ -142,15 +142,9 @@ nsresult nsGfxFactoryMac::CreateInstance(nsISupports *aOuter,
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst);
nsresult res = inst->QueryInterface(aIID, aResult);
if (res != NS_OK) {
// We didn't get the right interface, so clean up
delete inst;
}
// else {
// inst->Release();
// }
NS_RELEASE(inst);
return res;
}

View File

@ -106,12 +106,10 @@ nsresult nsLocaleMacFactory::CreateInstance(nsISupports *aOuter,
if (NULL == inst) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst);
nsresult res = inst->QueryInterface(aIID, aResult);
if(NS_FAILED(res)) {
delete inst;
}
NS_RELEASE(inst);
return res;
}

View File

@ -269,12 +269,9 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst);
nsresult res = inst->QueryInterface(aIID, aResult);
if (res != NS_OK) {
// We didn't get the right interface, so clean up
delete inst;
}
NS_RELEASE(inst);
return res;
}