We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75223b6 commit 61d2db7Copy full SHA for 61d2db7
SwiftTaskTests/AlamofireTests.swift
@@ -219,9 +219,11 @@ class AlamofireTests: _TestCase
219
}
220
221
// configure cancel for cleanup after reject or task.cancel()
222
- configure.cancel = {
223
- downloadRequst.cancel()
224
- return
+ // NOTE: use weak to let task NOT CAPTURE downloadRequst via configure
+ configure.cancel = { [weak downloadRequst] in
+ if let downloadRequst = downloadRequst {
225
+ downloadRequst.cancel()
226
+ }
227
228
229
} // end of 1st task definition (NOTE: don't chain with `then` or `catch` for 1st task cancellation)
0 commit comments