fix MLK bugs 13285 and 13286 and prevent repeated PrePopulateRegistry calls

This commit is contained in:
shaver@netscape.com
1999-09-08 04:22:37 +00:00
parent 0e60e2324e
commit f76e631685

View File

@@ -741,6 +741,8 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
{ {
nsresult rv; nsresult rv;
if (mPrePopulationDone)
return NS_OK;
// Read in all CID entries and populate the mFactories // Read in all CID entries and populate the mFactories
nsCOMPtr<nsIEnumerator> cidEnum; nsCOMPtr<nsIEnumerator> cidEnum;
rv = mRegistry->EnumerateSubtrees( mCLSIDKey, getter_AddRefs(cidEnum)); rv = mRegistry->EnumerateSubtrees( mCLSIDKey, getter_AddRefs(cidEnum));
@@ -773,7 +775,6 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
char *library = NULL; char *library = NULL;
rv = mRegistry->GetString(cidKey, inprocServerValueName, &library); rv = mRegistry->GetString(cidKey, inprocServerValueName, &library);
if (NS_FAILED(rv)) continue; if (NS_FAILED(rv)) continue;
autoStringFree delete_library(library, autoStringFree::NSPR_Delete);
nsCID aClass; nsCID aClass;
if (!(aClass.Parse(cidString))) continue; if (!(aClass.Parse(cidString))) continue;
@@ -783,9 +784,8 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
continue; continue;
nsFactoryEntry* entry = nsFactoryEntry* entry =
new nsFactoryEntry(aClass, PL_strdup(library), /* hand off componentType and library to factory */
/* hand off */ new nsFactoryEntry(aClass, library, componentType,
componentType,
nsCRT::strcmp(componentType, nsCRT::strcmp(componentType,
nativeComponentType) ? nativeComponentType) ?
0 : mNativeComponentLoader); 0 : mNativeComponentLoader);
@@ -1556,6 +1556,7 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
goto out; goto out;
} }
/* hand off aRegistryName to entry */
newEntry = new nsFactoryEntry(aClass, aRegistryName, newEntry = new nsFactoryEntry(aClass, aRegistryName,
nsCRT::strdup(aType), nsCRT::strdup(aType),
loader); loader);