Skip to content

Commit bbf05de

Browse files
committed
Merge pull request #16 from jmah/jmah/thread-safety-fix
Fix concurrency issue: Only alter completions dictionary while locked
2 parents bb8c9db + 18bfff5 commit bbf05de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Pod/Classes/PINURLSessionManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didComp
7272
[self.delegate didCompleteTask:task withError:error];
7373
[self lock];
7474
void (^completionHandler)(NSURLResponse *, NSError *) = self.completions[@(task.taskIdentifier)];
75+
[self.completions removeObjectForKey:@(task.taskIdentifier)];
7576
[self unlock];
7677
if (completionHandler) {
7778
completionHandler(task.response, error);
78-
[self.completions removeObjectForKey:@(task.taskIdentifier)];
7979
}
8080
}
8181

0 commit comments

Comments
 (0)