Bug 198601 - Moves QI outside of RegisterGenericFactory. r/sr=dougt

This commit is contained in:
dbradley%netscape.com 2003-03-22 02:04:53 +00:00
Родитель 030fae625f
Коммит bfea584f1f
1 изменённых файлов: 13 добавлений и 12 удалений

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

@ -201,7 +201,7 @@ nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
PR_STATIC_CALLBACK(nsresult) PR_STATIC_CALLBACK(nsresult)
RegisterGenericFactory(nsIComponentManager* compMgr, RegisterGenericFactory(nsIComponentRegistrar* registrar,
const nsModuleComponentInfo *info) const nsModuleComponentInfo *info)
{ {
nsresult rv; nsresult rv;
@ -209,14 +209,10 @@ RegisterGenericFactory(nsIComponentManager* compMgr,
rv = NS_NewGenericFactory(&fact, info); rv = NS_NewGenericFactory(&fact, info);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// what I want to do here is QI for a Component Registration Manager. Since this rv = registrar->RegisterFactory(info->mCID,
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home. info->mDescription,
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(compMgr, &rv); info->mContractID,
if (registrar) fact);
rv = registrar->RegisterFactory(info->mCID,
info->mDescription,
info->mContractID,
fact);
NS_RELEASE(fact); NS_RELEASE(fact);
return rv; return rv;
} }
@ -519,9 +515,14 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
if ( NS_FAILED(rv) ) return rv; if ( NS_FAILED(rv) ) return rv;
} }
for (int i = 0; i < components_length; i++) // what I want to do here is QI for a Component Registration Manager. Since this
RegisterGenericFactory(compMgr, &components[i]); // has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(
NS_STATIC_CAST(nsIComponentManager*,compMgr), &rv);
if (registrar) {
for (int i = 0; i < components_length; i++)
RegisterGenericFactory(registrar, &components[i]);
}
rv = nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry(); rv = nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry();
#ifdef DEBUG #ifdef DEBUG
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {