Closed Bug 73071 Opened 23 years ago Closed 23 years ago

nsIPlugin::Shutdown is not called if there is no nsIPluginInstance object created

Categories

(Core Graveyard :: Plug-ins, defect, P2)

x86
All
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9

People

(Reporter: serhunt, Assigned: serhunt)

Details

Attachments

(1 file)

It is possible that after general plugin initialization (nsIPlugin 
stuff) nsIPluginInstance object is never created. We should still call 
nsIPlugin::Shutdown method when we clean up. MRJ is an example of such a plugin.
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla0.9
--> 0.9
Patric, would you please take a look and if this patch will address what we 
talked about the other day?

NS_IMETHODIMP nsPluginHostImpl::Destroy(void)
{
  if (mIsDestroyed)
    return NS_OK;

  mIsDestroyed = PR_TRUE;

-  // at this point nsIPlugin::Shutdown calls will be performed if needed
+  // at this point nsIPlugin::Shutdown calls will be performed on last inst  
  mActivePluginList.shut();

+  //go through the list of the plugins to see if we have anything to shutdown
+  for(nsPluginTag * p = mPlugins; p != nsnull; p = p->mNext)
+  {
+    if(p->mEntryPoint != nsnull)
+    {
+      p->mEntryPoint->Shutdown();
+      p->mEntryPoint = nsnull;
+    }
+
+    if ((nsnull != p->mLibrary) && p->mCanUnloadLibrary)
+    {
+      PR_UnloadLibrary(p->mLibrary);
+      p->mLibrary = nsnull;
+    }
+  }

  return NS_OK;
}
I think I saw another bug like this. Is this patch going in?
I filed this bug after Patric pointed out this problem to me. I still want to 
see his response if the solution above will help.
Patch appears to work. r=beard
One point to consider, do we know that all existing plugin instances have been 
deleted at this point? If so, then this is what we've been needing all along.
Yes, mActivePluginList.shut(); destroys all the instances. But as far as I 
understand from what we talked about theoretically a plugin (nsIPlugin) may not 
even create a single instance (nsIPluginInstance) but still needs to be 
shutdown. This patch addresses this specific situation.
sr=waterson
There is a loop now in nsPluginHostImpl::Destroy to delete members of the 
plugin list (bug 73289) so we can move this shutdown stuff in there. No reason 
to have a separate loop for this.
cheked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified patch is in the tree.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: