mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Bug 1735152 - Avoid using NS_ADDREF in nsSocketTransport. r=dragana, a=RyanVM
This commit is contained in:
parent
6bc10cbc95
commit
1920aae3dc
1 changed files with 14 additions and 10 deletions
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:set ts=4 sw=4 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -2115,7 +2114,7 @@ NS_IMETHODIMP
|
|||
nsSocketTransport::OpenInputStream(uint32_t flags,
|
||||
uint32_t segsize,
|
||||
uint32_t segcount,
|
||||
nsIInputStream **result)
|
||||
nsIInputStream **aResult)
|
||||
{
|
||||
SOCKET_LOG(("nsSocketTransport::OpenInputStream [this=%p flags=%x]\n",
|
||||
this, flags));
|
||||
|
|
@ -2124,6 +2123,7 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncInputStream> pipeIn;
|
||||
nsCOMPtr<nsIInputStream> result;
|
||||
|
||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||
|
|
@ -2143,18 +2143,20 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
|
|||
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = pipeIn;
|
||||
result = pipeIn;
|
||||
}
|
||||
else
|
||||
*result = &mInput;
|
||||
result = &mInput;
|
||||
|
||||
// flag input stream as open
|
||||
mInputClosed = false;
|
||||
|
||||
rv = PostEvent(MSG_ENSURE_CONNECT);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(*result);
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -2162,7 +2164,7 @@ NS_IMETHODIMP
|
|||
nsSocketTransport::OpenOutputStream(uint32_t flags,
|
||||
uint32_t segsize,
|
||||
uint32_t segcount,
|
||||
nsIOutputStream **result)
|
||||
nsIOutputStream **aResult)
|
||||
{
|
||||
SOCKET_LOG(("nsSocketTransport::OpenOutputStream [this=%p flags=%x]\n",
|
||||
this, flags));
|
||||
|
|
@ -2171,6 +2173,8 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
|
||||
nsCOMPtr<nsIOutputStream> result;
|
||||
|
||||
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
|
||||
// XXX if the caller wants blocking, then the caller also gets buffered!
|
||||
//bool openBuffered = !(flags & OPEN_UNBUFFERED);
|
||||
|
|
@ -2189,10 +2193,10 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
|||
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = pipeOut;
|
||||
result = pipeOut;
|
||||
}
|
||||
else
|
||||
*result = &mOutput;
|
||||
result = &mOutput;
|
||||
|
||||
// flag output stream as open
|
||||
mOutputClosed = false;
|
||||
|
|
@ -2200,7 +2204,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
|
|||
rv = PostEvent(MSG_ENSURE_CONNECT);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ADDREF(*result);
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue