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

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.

Activity

  1. self-assigned this
    on Sep 4, 2015
  2. added this to the 0.7.1 milestone on Sep 4, 2015
  3. kean commented on Sep 4, 2015

    @kean
    OwnerAuthor

    Fixed 7491c82

  4. changed the title [-]DFImageManagerImageLoader sometimes prevents operation cancellation[/-] [+]DFImageManagerImageLoader sometimes fails to cancel fetch operations[/+] on Sep 4, 2015
  5. mythodeia commented on Sep 4, 2015

    @mythodeia

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

  6. kean commented on Sep 4, 2015

    @kean
    OwnerAuthor

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

  7. mythodeia commented on Sep 4, 2015

    @mythodeia

    @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

  8. kean commented on Sep 4, 2015

    @kean
    OwnerAuthor

    any contribution would be much appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions