Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlock when canceling processor task #374

Merged
merged 2 commits into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [fixed] Fixes a deadlock with canceling processor tasks [#374](https://github.com/pinterest/PINRemoteImage/pull/374) [zachwaugh](https://github.com/zachwaugh)
- [fixed] Fixes a deadlock in the retry system. [garrettmoon](https://github.com/garrettmoon)
- [fixed] Fixes a threadsafety issue in accessing callbacks. [garrettmoon](https://github.com/garrettmoon)
- [new] PINRemoteImageManager now respects the request timout value of session configuration. [garrettmoon](https://github.com/garrettmoon)
Expand Down
4 changes: 2 additions & 2 deletions Source/Classes/PINRemoteImageProcessorTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ - (BOOL)cancelWithUUID:(NSUUID *)UUID resume:(PINResume * _Nullable * _Nullable)
{
BOOL noMoreCompletions = [super cancelWithUUID:UUID resume:resume];
[self.lock lockWithBlock:^{
if (noMoreCompletions && self.downloadTaskUUID) {
[self.manager cancelTaskWithUUID:self.downloadTaskUUID];
if (noMoreCompletions && _downloadTaskUUID) {
[self.manager cancelTaskWithUUID:_downloadTaskUUID];
_downloadTaskUUID = nil;
}
}];
Expand Down