Fixing bug 180366, browser crashes on shutdown after scripting plugin, moving unused plugin library unloading to Observe("xpcom-shutdown") r=av sr=beard

git-svn-id: svn://10.0.0.236/trunk@135643 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterlubczynski%netscape.com 2002-12-26 22:54:46 +00:00
parent 0a0c74974d
commit 9650abcb60
2 changed files with 12 additions and 4 deletions

View File

@ -3283,7 +3283,12 @@ NS_IMETHODIMP nsPluginHostImpl::Destroy(void)
dirService->UnregisterProvider(mPrivateDirServiceProvider);
mPrivateDirServiceProvider = nsnull;
}
return NS_OK;
}
void nsPluginHostImpl::UnloadUnusedLibraries()
{
// unload any remaining plugin libraries from memory
for (PRInt32 i = 0; i < mUnusedLibraries.Count(); i++) {
PRLibrary * library = (PRLibrary *)mUnusedLibraries[i];
@ -3291,8 +3296,6 @@ NS_IMETHODIMP nsPluginHostImpl::Destroy(void)
PostPluginUnloadEvent(library);
}
mUnusedLibraries.Clear();
return NS_OK;
}
@ -6026,10 +6029,12 @@ NS_IMETHODIMP nsPluginHostImpl::Observe(nsISupports *aSubject,
#ifdef NS_DEBUG
printf("nsPluginHostImpl::Observe \"%s\"\n", aTopic ? aTopic : "");
#endif
if (!nsCRT::strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic) ||
!nsCRT::strcmp("quit-application", aTopic))
if (!nsCRT::strcmp("quit-application", aTopic))
{
Destroy();
} else if (!nsCRT::strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic))
{
UnloadUnusedLibraries();
}
return NS_OK;
}

View File

@ -474,6 +474,9 @@ private:
// one-off hack to include nppl3260.dll from the components folder
nsresult ScanForRealInComponentsFolder(nsIComponentManager * aCompManager);
// calls PostPluginUnloadEvent for each library in mUnusedLibraries
void UnloadUnusedLibraries();
char *mPluginPath;
nsPluginTag *mPlugins;
nsPluginTag *mCachedPlugins;