From 014a6bcfd1a3fe5a1c64b4f07e459f23d9d38e74 Mon Sep 17 00:00:00 2001 From: "serge%netscape.com" Date: Thu, 11 Apr 2002 03:27:00 +0000 Subject: [PATCH] fix #94895, Flash movie is constantly stopped and restarted, r=peterl, sr=beard --- layout/generic/nsObjectFrame.cpp | 17 +++++++++-------- layout/html/base/src/nsObjectFrame.cpp | 17 +++++++++-------- modules/plugin/base/src/ns4xPluginInstance.cpp | 10 +++++++--- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index da6adcdcd573..621fbd9fb2e7 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1196,10 +1196,6 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext, window->clipRect.right = 0; #endif -#ifdef XP_UNIX - window->ws_info = nsnull; //XXX need to figure out what this is. MMP -#endif - // Check to see if content-policy wants to veto this if(aURI != nsnull) { @@ -1275,10 +1271,6 @@ nsObjectFrame::ReinstantiatePlugin(nsIPresContext* aPresContext, nsHTMLReflowMet window->clipRect.right = NSTwipsToIntPixels(aMetrics.width, t2p); #endif -#ifdef XP_UNIX - window->ws_info = nsnull; //XXX need to figure out what this is. MMP -#endif - return NS_OK; } @@ -2013,6 +2005,15 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() NS_IF_RELEASE(mWidget); mContext = nsnull; + +#ifdef XP_UNIX + // the mem for this struct is allocated + // by PR_MALLOC in ns4xPluginInstance.cpp:ns4xPluginInstance::SetWindow() + if (mPluginWindow.ws_info) { + PR_Free(mPluginWindow.ws_info); + mPluginWindow.ws_info = nsnull; + } +#endif } /* diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index da6adcdcd573..621fbd9fb2e7 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -1196,10 +1196,6 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext, window->clipRect.right = 0; #endif -#ifdef XP_UNIX - window->ws_info = nsnull; //XXX need to figure out what this is. MMP -#endif - // Check to see if content-policy wants to veto this if(aURI != nsnull) { @@ -1275,10 +1271,6 @@ nsObjectFrame::ReinstantiatePlugin(nsIPresContext* aPresContext, nsHTMLReflowMet window->clipRect.right = NSTwipsToIntPixels(aMetrics.width, t2p); #endif -#ifdef XP_UNIX - window->ws_info = nsnull; //XXX need to figure out what this is. MMP -#endif - return NS_OK; } @@ -2013,6 +2005,15 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() NS_IF_RELEASE(mWidget); mContext = nsnull; + +#ifdef XP_UNIX + // the mem for this struct is allocated + // by PR_MALLOC in ns4xPluginInstance.cpp:ns4xPluginInstance::SetWindow() + if (mPluginWindow.ws_info) { + PR_Free(mPluginWindow.ws_info); + mPluginWindow.ws_info = nsnull; + } +#endif } /* diff --git a/modules/plugin/base/src/ns4xPluginInstance.cpp b/modules/plugin/base/src/ns4xPluginInstance.cpp index c962a593f510..7e6257a6265f 100644 --- a/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -673,11 +673,15 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void) NPError error; #if defined(MOZ_WIDGET_GTK) - if (mXtBin) + if (mXtBin) { gtk_widget_destroy(mXtBin); + mXtBin = 0; + } #elif defined(MOZ_WIDGET_XLIB) - if (mXlibXtBin) + if (mXlibXtBin) { mXlibXtBin->xtbin_destroy(); + mXlibXtBin = 0; + } #endif if(!mStarted) @@ -838,7 +842,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) window->width, window->height, win); #endif -#if 1 +#if 0 // if we destroyed the plugin when we left the page, we could remove this // code (i believe) the problem here is that the window gets destroyed when // its parent, etc does by changing a page the plugin instance is being