Skip to content

Commit

Permalink
Cancel moved to avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
heltoft committed Sep 28, 2020
1 parent 6444118 commit 96ed421
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 0 additions & 3 deletions Sources/Networking/SessionDataTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ public class SessionDataTask {
guard let callback = removeCallback(token) else {
return
}
if callbacksStore.count == 0 {
task.cancel()
}
onCallbackCancelled.call((token, callback))
}

Expand Down
1 change: 1 addition & 0 deletions Sources/Networking/SessionDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class SessionDelegate: NSObject {
// No other callbacks waiting, we can clear the task now.
if !task.containsCallbacks {
let dataTask = task.task
dataTask.cancel()
self.remove(dataTask)
}
}
Expand Down

0 comments on commit 96ed421

Please sign in to comment.