Skip to content

Commit a6ac40a

Browse files
committed
URLSessionTask retain cycle and memory leak fix
1 parent 81048e4 commit a6ac40a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Foundation/URLSession/URLSessionTask.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ extension _ProtocolClient : URLProtocolClient {
547547
session.taskRegistry.remove(task)
548548
}
549549
}
550+
task._protocol = nil
550551
}
551552

552553
func urlProtocol(_ protocol: URLProtocol, didCancel challenge: URLAuthenticationChallenge) {
@@ -602,6 +603,7 @@ extension _ProtocolClient : URLProtocolClient {
602603
session.taskRegistry.remove(task)
603604
}
604605
}
606+
task._protocol = nil
605607
}
606608

607609
func urlProtocol(_ protocol: URLProtocol, cachedResponseIsValid cachedResponse: CachedURLResponse) {

0 commit comments

Comments
 (0)