Skip to content

Fix progressive previews being dropped after a failed cached-data decode - #894

Merged
kean merged 2 commits into
mainfrom
fix/cached-decode-operation-leak
Aug 15, 2026
Merged

kean merged 2 commits into
mainfrom
fix/cached-decode-operation-leak

Conversation

@kean

@kean kean commented Aug 15, 2026

Copy link
Copy Markdown
Owner

TaskLoadImage.decodeCachedData goes through AsyncPipelineTask.decode, which stores the decoding-queue handle in operation whenever the decoder is asynchronous — any custom decoder, since the protocol default for isAsynchronous is true, or the default decoder with thumbnail options. didFinishDecoding(with:) never reset it, unlike TaskFetchOriginalImage.didFinishDecoding.

When the cached decode fails and the task falls back to fetchImage(), the stale non-nil handle trips the progressive back-pressure guards (else if operation != nil { return }), so every progressive preview is silently dropped for the rest of the task's lifetime. The final image still arrives.

didFinishDecoding(with:) now clears operation first.

`decodeCachedData` goes through `AsyncPipelineTask.decode`, which stores
the decoding-queue handle in `operation` whenever the decoder is
asynchronous. `didFinishDecoding(with:)` never reset it, unlike
`TaskFetchOriginalImage.didFinishDecoding`.

When the cached decode failed and the task fell back to `fetchImage()`,
the stale handle tripped the progressive back-pressure guards, so every
preview was silently dropped for the rest of the task's lifetime.
@kean kean added this to the 14.0 milestone Aug 15, 2026
@kean kean modified the milestones: 14.0, 13.2.0 Aug 15, 2026
@kean
kean merged commit bda4322 into main Aug 15, 2026
kean added a commit that referenced this pull request Aug 15, 2026
Fix progressive previews being dropped after a failed cached-data decode
@kean
kean deleted the fix/cached-decode-operation-leak branch August 16, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant