Moved code which was initalizing the memory allocation service from the constructor into the CreatePlugin function because it wasn't being called early enough for some plugins. Need to proceed on Bug 19931. r=av.

This commit is contained in:
bnesse%netscape.com 2000-07-11 20:08:05 +00:00
parent 23b031d8d8
commit 9c230e7301
2 changed files with 22 additions and 22 deletions

View File

@ -112,18 +112,12 @@ static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, nsIServiceManager* serviceMgr)
{
NS_INIT_REFCNT();
NS_INIT_REFCNT();
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
mServiceMgr = serviceMgr;
if(serviceMgr != nsnull)
{
if (nsnull == mMalloc)
serviceMgr->GetService(kMemoryCID, kIMemoryIID, (nsISupports**)&mMalloc);
}
mServiceMgr = serviceMgr;
}
@ -195,7 +189,13 @@ nsresult
ns4xPlugin::CreatePlugin(nsPluginTag* pluginTag, nsIServiceManager* serviceMgr)
{
CheckClassInitialized();
// set up the MemAllocator service now because it might be used by the plugin
if (serviceMgr != nsnull) {
if (nsnull == mMalloc)
serviceMgr->GetService(kMemoryCID, kIMemoryIID, (nsISupports**)&mMalloc);
}
#ifdef NS_DEBUG
printf("debug: edburns ns4xPlugin::CreatePlugin\n");
#endif

View File

@ -112,18 +112,12 @@ static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, NP_PLUGINSHUTDOWN aShutdown, nsIServiceManager* serviceMgr)
{
NS_INIT_REFCNT();
NS_INIT_REFCNT();
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
fShutdownEntry = aShutdown;
mServiceMgr = serviceMgr;
if(serviceMgr != nsnull)
{
if (nsnull == mMalloc)
serviceMgr->GetService(kMemoryCID, kIMemoryIID, (nsISupports**)&mMalloc);
}
mServiceMgr = serviceMgr;
}
@ -195,7 +189,13 @@ nsresult
ns4xPlugin::CreatePlugin(nsPluginTag* pluginTag, nsIServiceManager* serviceMgr)
{
CheckClassInitialized();
// set up the MemAllocator service now because it might be used by the plugin
if (serviceMgr != nsnull) {
if (nsnull == mMalloc)
serviceMgr->GetService(kMemoryCID, kIMemoryIID, (nsISupports**)&mMalloc);
}
#ifdef NS_DEBUG
printf("debug: edburns ns4xPlugin::CreatePlugin\n");
#endif