Prevent call into plugin if plugin is stopped. Fixes crash in plugin while reload/navigate while plugin is streaming. bug 54186, r=av, sr=buster

git-svn-id: svn://10.0.0.236/trunk@81883 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterlubczynski%netscape.com
2000-10-27 22:05:07 +00:00
parent 36c9406119
commit e7c9040b5e
4 changed files with 52 additions and 10 deletions

View File

@@ -65,6 +65,7 @@ public:
ns4xPluginStreamListener(nsIPluginInstance* inst, void* notifyData);
virtual ~ns4xPluginStreamListener(void);
PRBool IsStarted(void);
protected:
@@ -200,13 +201,19 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
// relies on routine descriptors, not present in carbon.
// We need to fix this.
PRLibrary* lib = nsnull;
if(mInst)
lib = mInst->fLibrary;
PRLibrary* lib = nsnull;
PRBool started = PR_FALSE;
if(mInst) {
lib = mInst->fLibrary;
started = mInst->IsStarted();
}
if (started)
{
NS_TRY_SAFE_CALL_RETURN(numtowrite, CallNPP_WriteReadyProc(callbacks->writeready,
npp,
&mNPStream), lib);
}
#endif
// if WriteReady returned 0, the plugin is not ready to handle
@@ -271,13 +278,19 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo,
// We need to fix this.
PRLibrary* lib = nsnull;
if(mInst)
PRBool started = PR_FALSE;
if(mInst) {
lib = mInst->fLibrary;
started = mInst->IsStarted();
}
NS_TRY_SAFE_CALL_VOID(CallNPP_StreamAsFileProc(callbacks->asfile,
if (started)
{
NS_TRY_SAFE_CALL_VOID(CallNPP_StreamAsFileProc(callbacks->asfile,
npp,
&mNPStream,
fileName), lib);
}
#endif
return NS_OK;
@@ -379,6 +392,11 @@ ns4xPluginInstance :: ~ns4xPluginInstance(void)
#endif
}
PRBool
ns4xPluginInstance :: IsStarted(void)
{
return mStarted;
}
////////////////////////////////////////////////////////////////////////

View File

@@ -105,6 +105,9 @@ public:
// Use Release() to destroy this
virtual ~ns4xPluginInstance(void);
// returns the state of mStarted
PRBool IsStarted(void);
protected:
nsresult InitializePlugin(nsIPluginInstancePeer* peer);

View File

@@ -65,6 +65,7 @@ public:
ns4xPluginStreamListener(nsIPluginInstance* inst, void* notifyData);
virtual ~ns4xPluginStreamListener(void);
PRBool IsStarted(void);
protected:
@@ -200,13 +201,19 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
// relies on routine descriptors, not present in carbon.
// We need to fix this.
PRLibrary* lib = nsnull;
if(mInst)
lib = mInst->fLibrary;
PRLibrary* lib = nsnull;
PRBool started = PR_FALSE;
if(mInst) {
lib = mInst->fLibrary;
started = mInst->IsStarted();
}
if (started)
{
NS_TRY_SAFE_CALL_RETURN(numtowrite, CallNPP_WriteReadyProc(callbacks->writeready,
npp,
&mNPStream), lib);
}
#endif
// if WriteReady returned 0, the plugin is not ready to handle
@@ -271,13 +278,19 @@ ns4xPluginStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo,
// We need to fix this.
PRLibrary* lib = nsnull;
if(mInst)
PRBool started = PR_FALSE;
if(mInst) {
lib = mInst->fLibrary;
started = mInst->IsStarted();
}
NS_TRY_SAFE_CALL_VOID(CallNPP_StreamAsFileProc(callbacks->asfile,
if (started)
{
NS_TRY_SAFE_CALL_VOID(CallNPP_StreamAsFileProc(callbacks->asfile,
npp,
&mNPStream,
fileName), lib);
}
#endif
return NS_OK;
@@ -379,6 +392,11 @@ ns4xPluginInstance :: ~ns4xPluginInstance(void)
#endif
}
PRBool
ns4xPluginInstance :: IsStarted(void)
{
return mStarted;
}
////////////////////////////////////////////////////////////////////////

View File

@@ -105,6 +105,9 @@ public:
// Use Release() to destroy this
virtual ~ns4xPluginInstance(void);
// returns the state of mStarted
PRBool IsStarted(void);
protected:
nsresult InitializePlugin(nsIPluginInstancePeer* peer);