Skip to content

Snapshot arrays in ImagePrefetcher.handleComplete#2465

Merged
onevcat merged 1 commit intoonevcat:masterfrom
erichoracek:fix/imageprefetcher-handlecomplete-race
Jan 25, 2026
Merged

Snapshot arrays in ImagePrefetcher.handleComplete#2465
onevcat merged 1 commit intoonevcat:masterfrom
erichoracek:fix/imageprefetcher-handlecomplete-race

Conversation

@erichoracek
Copy link
Copy Markdown
Contributor

@erichoracek erichoracek commented Dec 21, 2025

Mitigates a crash from iterating over sources while they are mutating.

Example crash:

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: SEGV_NOOP
Crashed Thread: 0

Application Specific Information:
Exception 1, Code 1, Subcode 18446744073709551608 >
KERN_INVALID_ADDRESS at 0x….

0   App            <redacted>  Source
1   App            <redacted>  Source
2   App            <redacted>  Array._getElement
3   App            <redacted>  Sequence.compactMap
4   App            <redacted>  ImagePrefetcher.handleComplete (ImagePrefetcher.swift:379)

Mitigates a crash from iterating over sources while they are mutating.

Example crash (details omitted):
```
0   App            <redacted>  Source
1   App            <redacted>  Source
2   App            <redacted>  Array._getElement
3   App            <redacted>  Sequence.compactMap
4   App            <redacted>  ImagePrefetcher.handleComplete (ImagePrefetcher.swift:379)
```
@onevcat
Copy link
Copy Markdown
Owner

onevcat commented Jan 25, 2026

Thank you for catching it!

@onevcat onevcat merged commit f694011 into onevcat:master Jan 25, 2026
onevcat added a commit that referenced this pull request Feb 18, 2026
Add @sendable attribute to PrefetcherProgressBlock,
PrefetcherSourceProgressBlock, PrefetcherCompletionHandler, and
PrefetcherSourceCompletionHandler to fix Swift 6 concurrency warnings
introduced by PR #2465.

These callbacks are invoked across isolation domains (from prefetchQueue
to main queue), so marking them @sendable is semantically correct.
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.

2 participants