Fix blocker bug 105548 (the mac installer crash). The xpistub code was creating nsLocalFileMac objects, but never refcounting them, so they got deleted before the GetPath() method was called (how did this ever work???). Fixed using COMPtrs. r=ccarlen, a=jj

git-svn-id: svn://10.0.0.236/trunk@111505 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sfraser%netscape.com
2002-01-07 22:22:12 +00:00
parent 488314352a
commit 7b44b522f3

View File

@@ -103,23 +103,17 @@ PR_PUBLIC_API(nsresult) XPI_Init(
// Initialize XPCOM and AutoRegister() its components
//--------------------------------------------------------------------
#ifdef XP_MAC
nsLocalFile *binDir = new nsLocalFile;
if (binDir)
{
binDir->InitWithFSSpec(&aXPIStubDir);
rv = NS_InitXPCOM2(&gServiceMgr, binDir, nsnull);
}
else
return NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFileMac> binDir;
rv = NS_NewLocalFileWithFSSpec((FSSpec*)&aXPIStubDir, PR_FALSE, getter_AddRefs(binDir));
if (NS_FAILED(rv)) return rv;
rv = NS_InitXPCOM2(&gServiceMgr, binDir, nsnull);
// binDir is contaminated now. Need compDir to pass to AutoRegister.
nsLocalFile *compDir = new nsLocalFile;
if (compDir)
compDir->InitWithFSSpec(&aXPIStubDir);
else
return NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFileMac> compDir;
rv = NS_NewLocalFileWithFSSpec((FSSpec*)&aXPIStubDir, PR_FALSE, getter_AddRefs(compDir));
if (NS_FAILED(rv)) return rv;
#elif defined(XP_PC)
char componentPath[MAX_PATH];