зеркало из https://github.com/mozilla/pjs.git
Fix a leak of the output stream and socket transport due to shutdown ordering problems (bug 200094). Patch by darin, r=dougt, sr=me.
This commit is contained in:
Родитель
09fa9aa380
Коммит
13a3cccaea
|
@ -111,14 +111,15 @@ nsFtpControlConnection::Connect(nsIProxyInfo* proxyInfo)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// open buffered, non-blocking/asynchronous input stream to socket.
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
rv = mCPipe->OpenInputStream(0,
|
||||
FTP_COMMAND_CHANNEL_SEG_SIZE,
|
||||
FTP_COMMAND_CHANNEL_SEG_COUNT,
|
||||
getter_AddRefs(mInStream));
|
||||
getter_AddRefs(inStream));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIInputStreamPump> pump;
|
||||
rv = NS_NewInputStreamPump(getter_AddRefs(pump), mInStream);
|
||||
rv = NS_NewInputStreamPump(getter_AddRefs(pump), inStream);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get the ball rolling by reading on the control socket.
|
||||
|
@ -140,12 +141,11 @@ nsFtpControlConnection::Disconnect(nsresult status)
|
|||
|
||||
if (NS_FAILED(status)) {
|
||||
// break cyclic reference!
|
||||
mOutStream = 0;
|
||||
mReadRequest->Cancel(status);
|
||||
mReadRequest = 0;
|
||||
mCPipe->Close(status);
|
||||
mCPipe = 0;
|
||||
mInStream = 0;
|
||||
mOutStream = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -87,7 +87,6 @@ private:
|
|||
|
||||
nsCOMPtr<nsIRequest> mReadRequest;
|
||||
nsCOMPtr<nsISocketTransport> mCPipe;
|
||||
nsCOMPtr<nsIInputStream> mInStream;
|
||||
nsCOMPtr<nsIOutputStream> mOutStream;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче