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

DFImageManagerImageLoader sometimes fails to cancel fetch operations #71

@kean

Description

@kean

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions