Fixed nsIPluginInputStream::Close method to not crash.

git-svn-id: svn://10.0.0.236/trunk@11816 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
1998-10-02 22:28:51 +00:00
parent 451e941a23
commit f0ffc7b067
5 changed files with 39 additions and 8 deletions

View File

@@ -1640,7 +1640,7 @@ nsPluginInputStream::nsPluginInputStream(nsIPluginStreamListener* listener,
nsPluginStreamType streamType)
: mListener(listener), mStreamType(streamType),
mUrls(NULL), mStream(NULL),
mBuffer(NULL)
mBuffer(NULL), mClosed(PR_FALSE)
// mBuffer(NULL), mBufferLength(0), mAmountRead(0)
{
NS_INIT_REFCNT();
@@ -1686,14 +1686,21 @@ nsPluginInputStream::Cleanup(void)
}
mBuffer = NULL;
}
mClosed = PR_TRUE;
}
NS_METHOD
nsPluginInputStream::Close(void)
{
NPError err = NPERR_NO_ERROR;
Cleanup();
NPError err = npn_destroystream(mStream->instance->npp, mStream->pstream,
nsPluginReason_UserBreak);
#if 0 /* According to the plugin documentation, this would seem to be the
* right thing to do here, but it's not (and calling NPN_DestroyStream
* in the 4.0 browser during an NPP_Write call will crash the browser).
*/
err = npn_destroystream(mStream->instance->npp, mStream->pstream,
nsPluginReason_UserBreak);
#endif
return fromNPError[err];
}