summaryrefslogtreecommitdiffstats
path: root/net/socket/client_socket_pool_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket/client_socket_pool_base.cc')
-rw-r--r--net/socket/client_socket_pool_base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 70358d1..631ef5e 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -583,6 +583,12 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete(
BoundNetLog job_log = job->net_log();
+ // ConnectJobs may hold references to pools which may hold references back to
+ // this pool, so RemoveConnectJob() may eventually lead to something calling
+ // Release() on |this| which deletes it in the middle of this function. Hold
+ // a self-reference to prevent deletion of |this|.
+ const scoped_refptr<ClientSocketPoolBaseHelper> self(this);
+
if (result == OK) {
DCHECK(socket.get());
RemoveConnectJob(job, group);