Landing fix for bug 421833 for 3.0. Fix plugin crash due to our layout frame getting deleted underneath us. r+sr=jonas@sicking.cc, a=samuel.sidler@gmail.com

git-svn-id: svn://10.0.0.236/trunk@253661 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.org
2008-08-17 00:55:24 +00:00
parent 81641f9c64
commit 09f2a1426d

View File

@@ -864,6 +864,8 @@ nsObjectFrame::InstantiatePlugin(nsIPluginHost* aPluginHost,
mInstanceOwner);
}
// Note that |this| may very well be destroyed already!
if (appShell) {
appShell->ResumeNative();
}
@@ -1589,7 +1591,8 @@ nsObjectFrame::HandleEvent(nsPresContext* aPresContext,
return rv;
}
nsresult nsObjectFrame::GetPluginInstance(nsIPluginInstance*& aPluginInstance)
nsresult
nsObjectFrame::GetPluginInstance(nsIPluginInstance*& aPluginInstance)
{
aPluginInstance = nsnull;
@@ -1646,9 +1649,16 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList
// This must be done before instantiating the plugin
FixupWindow(mRect.Size());
nsWeakFrame weakFrame(this);
NS_ASSERTION(!mPreventInstantiation, "Say what?");
mPreventInstantiation = PR_TRUE;
rv = pluginHost->InstantiatePluginForChannel(aChannel, mInstanceOwner, aStreamListener);
if (!weakFrame.IsAlive()) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_ASSERTION(mPreventInstantiation,
"Instantiation should still be prevented!");
mPreventInstantiation = PR_FALSE;
@@ -1674,6 +1684,8 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
nsresult rv = PrepareInstanceOwner();
NS_ENSURE_SUCCESS(rv, rv);
nsWeakFrame weakFrame(this);
// This must be done before instantiating the plugin
FixupWindow(mRect.Size());
@@ -1687,9 +1699,18 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
rv = InstantiatePlugin(pluginHost, aMimeType, aURI);
if (!weakFrame.IsAlive()) {
return NS_ERROR_NOT_AVAILABLE;
}
// finish up
if (NS_SUCCEEDED(rv)) {
TryNotifyContentObjectWrapper();
if (!weakFrame.IsAlive()) {
return NS_ERROR_NOT_AVAILABLE;
}
CallSetWindow();
}