Bug 334549: Fix for Coverty CID 179: assert instead try to handle being called twice. patch by Jon Smirl <jonsmirl@yahoo.com>, r=bsmedberg, sr=darin

This commit is contained in:
ajschult%verizon.net 2006-05-01 03:47:02 +00:00
parent 4571423968
commit 5e855c68ad

View File

@ -513,16 +513,6 @@ NS_InitXPCOM3(nsIServiceManager* *result,
if (NS_FAILED(rv))
return rv;
// Create the Component/Service Manager
nsComponentManagerImpl *compMgr = NULL;
if (nsComponentManagerImpl::gComponentManager == NULL)
{
compMgr = new nsComponentManagerImpl();
if (compMgr == NULL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(compMgr);
nsCOMPtr<nsIFile> xpcomLib;
PRBool value;
@ -551,6 +541,14 @@ NS_InitXPCOM3(nsIServiceManager* *result,
if (NS_FAILED(rv)) return rv;
}
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
// Create the Component/Service Manager
nsComponentManagerImpl *compMgr = new nsComponentManagerImpl();
if (compMgr == NULL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(compMgr);
rv = compMgr->Init(staticComponents, componentCount);
if (NS_FAILED(rv))
{
@ -566,7 +564,6 @@ NS_InitXPCOM3(nsIServiceManager* *result,
NS_ADDREF(*result = serviceManager);
}
}
nsCOMPtr<nsIMemory> memory;
NS_GetMemoryManager(getter_AddRefs(memory));