diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index e1746358be82..d2ca2acb89b4 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -1479,7 +1479,12 @@ NS_IMETHODIMP nsPluginHostImpl::Destroy(void) for(i=0; iDestroy(); + NS_RELEASE(mActivePluginList[i].mInstance); + NS_RELEASE(mActivePluginList[i].mPeer); + PL_strfree(mActivePluginList[i].mURL); + } } while (nsnull != plug) @@ -1719,6 +1724,9 @@ void nsPluginHostImpl::AddInstanceToActiveList(nsIPluginInstance* aInstance, if(mOldestActivePlugin == MAX_ACTIVE_PLUGINS) mOldestActivePlugin = 0; } + + NS_ADDREF(aInstance); + nsCRT::free(url); } @@ -1786,6 +1794,7 @@ NS_IMETHODIMP nsPluginHostImpl::SetUpPluginInstance(const char *aMimeType, return result; } + // it is adreffed here aOwner->SetInstance(instance); nsPluginInstancePeerImpl *peer = new nsPluginInstancePeerImpl(); @@ -1807,9 +1816,11 @@ NS_IMETHODIMP nsPluginHostImpl::SetUpPluginInstance(const char *aMimeType, NS_RELEASE(pi); + // we should addref here AddInstanceToActiveList(instance, aURL); - //NS_RELEASE(instance); + //release what was addreffed in Create(Plugin)Instance + NS_RELEASE(instance); return NS_OK; } diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/modules/plugin/nglsrc/nsPluginHostImpl.cpp index e1746358be82..d2ca2acb89b4 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -1479,7 +1479,12 @@ NS_IMETHODIMP nsPluginHostImpl::Destroy(void) for(i=0; iDestroy(); + NS_RELEASE(mActivePluginList[i].mInstance); + NS_RELEASE(mActivePluginList[i].mPeer); + PL_strfree(mActivePluginList[i].mURL); + } } while (nsnull != plug) @@ -1719,6 +1724,9 @@ void nsPluginHostImpl::AddInstanceToActiveList(nsIPluginInstance* aInstance, if(mOldestActivePlugin == MAX_ACTIVE_PLUGINS) mOldestActivePlugin = 0; } + + NS_ADDREF(aInstance); + nsCRT::free(url); } @@ -1786,6 +1794,7 @@ NS_IMETHODIMP nsPluginHostImpl::SetUpPluginInstance(const char *aMimeType, return result; } + // it is adreffed here aOwner->SetInstance(instance); nsPluginInstancePeerImpl *peer = new nsPluginInstancePeerImpl(); @@ -1807,9 +1816,11 @@ NS_IMETHODIMP nsPluginHostImpl::SetUpPluginInstance(const char *aMimeType, NS_RELEASE(pi); + // we should addref here AddInstanceToActiveList(instance, aURL); - //NS_RELEASE(instance); + //release what was addreffed in Create(Plugin)Instance + NS_RELEASE(instance); return NS_OK; }