110366 r/sr=darin, addref the reader before using it so that it doesn't get released from under us.

This commit is contained in:
naving%netscape.com 2001-11-20 21:09:14 +00:00
Родитель 241f6cc71a
Коммит 730f567767
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -364,6 +364,7 @@ nsStorageTransport::AsyncRead(nsIStreamListener *aListener,
NS_NEWXPCOM(reader, nsReadRequest);
if (!reader)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(reader);
reader->SetTransport(this);
reader->SetTransferOffset(aOffset);
@ -376,14 +377,14 @@ nsStorageTransport::AsyncRead(nsIStreamListener *aListener,
rv = reader->SetListener(aListener, aContext);
if (NS_FAILED(rv)) goto error;
rv = reader->Process();
if (NS_FAILED(rv)) goto error;
NS_ADDREF(*aRequest = reader);
rv = reader->Process();
if (NS_FAILED(rv)) goto error;
*aRequest = reader;
return NS_OK;
error:
NS_DELETEXPCOM(reader);
NS_RELEASE(reader);
return rv;
}