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
Родитель 00f9c67d96
Коммит d3c6265c13
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -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;