Fixing bug 474866. Don't null out the peer when stopping plugins to break reference cycles, as cached plugins depend on the peer remaining set. Null out the owner instead. r=joshmoz@gmail.com, sr=bzbarsky@mit.edu

This commit is contained in:
Johnny Stenback 2009-01-25 09:05:00 -08:00
Родитель f0559e5d15
Коммит 7bb77ff7d5
2 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -841,8 +841,6 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop(void)
}
if (!mStarted) {
// Break our cycle with the peer that owns us.
mPeer = nsnull;
return NS_OK;
}
@ -861,8 +859,6 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop(void)
OnPluginDestroy(&fNPP);
if (fCallbacks->destroy == NULL) {
// Break our cycle with the peer that owns us.
mPeer = nsnull;
return NS_ERROR_FAILURE;
}
@ -890,9 +886,6 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop(void)
nsJSNPRuntime::OnPluginDestroy(&fNPP);
// Break our cycle with the peer that owns us.
mPeer = nsnull;
if (error != NPERR_NO_ERROR)
return NS_ERROR_FAILURE;
else

Просмотреть файл

@ -5909,6 +5909,16 @@ nsPluginHostImpl::StopPluginInstance(nsIPluginInstance* aInstance)
}
}
}
nsCOMPtr<nsIPluginInstancePeer> peer;
aInstance->GetPeer(getter_AddRefs(peer));
if (peer) {
// Break the reference cycle between the instance, peer, and
// owner.
((nsPluginInstancePeerImpl*)peer.get())->SetOwner(nsnull);
}
return NS_OK;
}