fixes bug 190860 "trunk topcrash [@ _PR_Getfd]" r=dougt sr=bz a=asa

This commit is contained in:
darin%netscape.com 2003-02-13 19:02:25 +00:00
parent a01da841e5
commit d021d7d179

View File

@ -266,6 +266,10 @@ nsInputStreamPump::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
if (NS_FAILED(rv)) return rv;
}
// release our reference to the original stream. from this point forward,
// we only reference the "stream" via mAsyncStream.
mStream = 0;
// mStreamOffset now holds the number of bytes currently read. we use this
// to enforce the mStreamLength restriction.
mStreamOffset = 0;
@ -456,11 +460,13 @@ nsInputStreamPump::OnStateStop()
{
LOG((" OnStateStop [this=%x status=%x]\n", this, mStatus));
// in most cases mAsyncStream is already closed (NOTE: Close is idempotent).
// however, mAsyncStream may still be open if mStreamLength was reached
// before EOF.
if (mCloseWhenDone)
mStream->Close();
mStream = 0;
mAsyncStream = 0;
mAsyncStream->Close();
mAsyncStream = 0;
mEventQ = 0;
mIsPending = PR_FALSE;