Eliminate static nsCOMPtr variables in editor factory classes.

These were causing a crash on exit, bug 7938.
Approved by chofmann; Reviewed in concept by dp,
in detail by braddr@portland.puremagic.com and sfraser.


git-svn-id: svn://10.0.0.236/trunk@35876 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
1999-06-18 21:10:59 +00:00
parent 46cb6c6ada
commit 86bd6bd89c
4 changed files with 44 additions and 40 deletions

View File

@@ -128,17 +128,17 @@ nsEditorShellFactoryImpl::LockFactory(PRBool aLock)
nsresult
GetEditorShellFactory(nsIFactory **aFactory, const nsCID &aClass, const char *aClassName, const char *aProgID)
{
static nsCOMPtr<nsIFactory> g_pNSIFactory;
PR_EnterMonitor(GetEditorMonitor());
nsresult result = NS_ERROR_FAILURE;
if (!g_pNSIFactory)
{
nsEditorShellFactoryImpl* factory = new nsEditorShellFactoryImpl(aClass, aClassName, aProgID);
g_pNSIFactory = do_QueryInterface(factory);
if (factory)
result = NS_OK;
}
result = g_pNSIFactory->QueryInterface(kIFactoryIID, (void **)aFactory);
nsEditorShellFactoryImpl* factory = new nsEditorShellFactoryImpl(aClass, aClassName, aProgID);
if (!factory)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIFactory> pNSIFactory (do_QueryInterface(factory));
if (!pNSIFactory)
return NS_ERROR_NO_INTERFACE;
nsresult result = pNSIFactory->QueryInterface(kIFactoryIID,
(void **)aFactory);
PR_ExitMonitor(GetEditorMonitor());
return result;
}