diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 23:39:18 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 23:39:18 +0000 |
commit | 6af4e414c3e6b54738a214b87cfe12c0b69b303c (patch) | |
tree | f489dfdd5f75cae6a855d3fb3f919c962acfbbc0 /net/spdy/spdy_proxy_client_socket.cc | |
parent | b60cd2c1b98ad78e0a51c9922eee6bbf2e6b857f (diff) | |
download | chromium_src-6af4e414c3e6b54738a214b87cfe12c0b69b303c.zip chromium_src-6af4e414c3e6b54738a214b87cfe12c0b69b303c.tar.gz chromium_src-6af4e414c3e6b54738a214b87cfe12c0b69b303c.tar.bz2 |
Change SpdyProxyClientSocket::OnClose to not call the write callback if this has been deleted.
BUG=105285
TEST=SpdyProxyClientSocket.Rst\*
Review URL: http://codereview.chromium.org/8729007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_proxy_client_socket.cc')
-rw-r--r-- | net/spdy/spdy_proxy_client_socket.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 6ef88e7..484be0c 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -45,6 +45,7 @@ SpdyProxyClientSocket::SpdyProxyClientSocket( write_buffer_len_(0), write_bytes_outstanding_(0), eof_has_been_read_(false), + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), net_log_(spdy_stream->net_log()) { request_.method = "CONNECT"; request_.url = url; @@ -516,6 +517,7 @@ void SpdyProxyClientSocket::OnClose(int status) { else next_state_ = STATE_DISCONNECTED; + base::WeakPtr<SpdyProxyClientSocket> weak_ptr = weak_factory_.GetWeakPtr(); OldCompletionCallback* write_callback = write_callback_; write_callback_ = NULL; write_buffer_len_ = 0; @@ -529,10 +531,11 @@ void SpdyProxyClientSocket::OnClose(int status) { read_callback_ = NULL; read_callback->Run(status); } else if (read_callback_) { - // If we have a read_callback, the we need to make sure we call it back + // If we have a read_callback_, the we need to make sure we call it back. OnDataReceived(NULL, 0); } - if (write_callback) + // This may have been deleted by read_callback_, so check first. + if (weak_ptr && write_callback) write_callback->Run(ERR_CONNECTION_CLOSED); } |