From 69b4d53f01316763c43ffde1350b3b86a73048a7 Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Fri, 25 Feb 2000 01:02:53 +0000 Subject: [PATCH] Fixing 27486, r=beard --- layout/generic/nsObjectFrame.cpp | 22 ++++++++++++++++++++-- layout/html/base/src/nsObjectFrame.cpp | 22 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index e264b8a0fbd..c8cb811d612 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -208,6 +208,8 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; #endif + NS_IMETHOD Destroy(nsIPresContext* aPresContext); + NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, nsISupports* aSubContent); @@ -401,6 +403,24 @@ nsObjectFrame::Init(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsObjectFrame::Destroy(nsIPresContext* aPresContext) +{ + // we need to finish with the plugin before native window is destroyed + // doing this in the destructor is too late. + if(mInstanceOwner != nsnull) + { + nsIPluginInstance *inst; + mInstanceOwner->GetInstance(inst); + if(inst != nsnull) + { + inst->Stop(); + inst->SetWindow(nsnull); + } + } + return nsObjectFrameSuper::Destroy(aPresContext); +} + NS_IMETHODIMP nsObjectFrame::GetFrameType(nsIAtom** aType) const { @@ -1414,8 +1434,6 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() if (nsnull != mInstance) { mPluginHost->StopPluginInstance(mInstance); - mInstance->Stop(); - mInstance->SetWindow(nsnull); NS_RELEASE(mInstance); } diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index e264b8a0fbd..c8cb811d612 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -208,6 +208,8 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; #endif + NS_IMETHOD Destroy(nsIPresContext* aPresContext); + NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, nsIContent* aChild, nsISupports* aSubContent); @@ -401,6 +403,24 @@ nsObjectFrame::Init(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsObjectFrame::Destroy(nsIPresContext* aPresContext) +{ + // we need to finish with the plugin before native window is destroyed + // doing this in the destructor is too late. + if(mInstanceOwner != nsnull) + { + nsIPluginInstance *inst; + mInstanceOwner->GetInstance(inst); + if(inst != nsnull) + { + inst->Stop(); + inst->SetWindow(nsnull); + } + } + return nsObjectFrameSuper::Destroy(aPresContext); +} + NS_IMETHODIMP nsObjectFrame::GetFrameType(nsIAtom** aType) const { @@ -1414,8 +1434,6 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() if (nsnull != mInstance) { mPluginHost->StopPluginInstance(mInstance); - mInstance->Stop(); - mInstance->SetWindow(nsnull); NS_RELEASE(mInstance); }