Fix for about:blank to work -- not destroy the listener prematurely in the OnStopRequest method.

This commit is contained in:
warren%netscape.com 1999-07-03 20:27:27 +00:00
parent 00f9c67d96
commit d3c6265c13

View File

@ -18,6 +18,7 @@
#include "nsInputStreamChannel.h"
#include "nsIStreamListener.h"
#include "nsCOMPtr.h"
////////////////////////////////////////////////////////////////////////////////
// nsInputStreamChannel methods:
@ -126,6 +127,11 @@ nsInputStreamChannel::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
{
// currently this happens before AsyncRead returns -- hope that's ok
nsresult rv;
// Do an extra AddRef so that this method's synchronous operation doesn't end up destroying
// the listener prematurely.
nsCOMPtr<nsIStreamListener> l(listener);
rv = listener->OnStartRequest(ctxt);
if (NS_FAILED(rv)) return rv;