Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.

DFImageManagerImageLoader sometimes fails to cancel fetch operations #71

Closed
kean opened this issue Sep 4, 2015 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@kean
Copy link
Owner

kean commented Sep 4, 2015

DFImageManagerImageLoader (private class) uses a single fetch operation for equivalent request. Executing operations are stored in a dictionary with wrapped requests as a keys. This dictionary is the only object that holds strong references to the operations.

Operations are removed from the dictionary in two places:

  1. When image task is cancelled and there are no remaining tasks that are subscribed to the operation
  2. When operation is complete

Operation's completion handler is called for cancelled operations. The problem arises when you start, cancel and then restart the same requests very fast. In that case there is a chance that DFImageManagerImageLoader would remove a second operation (for restarted request) when handling completion of the first operation (which was cancelled). The requests are the same, but operations are different. This would lead to the operation deallocation (actually deallocation of its wrapper) which would prevent DFImageManagerImageLoader from cancellation and reusing this operation later.

@kean kean added the bug label Sep 4, 2015
@kean kean self-assigned this Sep 4, 2015
@kean kean added this to the 0.7.1 milestone Sep 4, 2015
@kean
Copy link
Owner Author

kean commented Sep 4, 2015

Fixed 7491c82

@kean kean closed this as completed Sep 4, 2015
@kean kean changed the title DFImageManagerImageLoader sometimes prevents operation cancellation DFImageManagerImageLoader sometimes fails to cancel fetch operations Sep 4, 2015
@mythodeia
Copy link

@kean are you planning on releasing a new version soon? thanks

@kean
Copy link
Owner Author

kean commented Sep 4, 2015

@mythodeia yep, releasing it today. Going to drop sdwebimage? 😉

@mythodeia
Copy link

@kean 😮 oh come on! play nice! i admit we need a major update but time is always against us. And i have to admit your work is exceptional and tempting

@kean
Copy link
Owner Author

kean commented Sep 4, 2015

any contribution would be much appreciated :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants