Skip to content

Wire the ImageTask before it is handed to imageTaskCreated - #1086

Draft
kean wants to merge 2 commits into
mainfrom
fix/image-task-created-wiring
Draft

kean wants to merge 2 commits into
mainfrom
fix/image-task-created-wiring

Conversation

@kean

@kean kean commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Split out of #1025.

imageTaskCreated is called synchronously with the task, and a delegate can await the response right away, for example from a Task it starts. _task was still unset at that point, which trapped on the implicitly unwrapped optional.

The backing Task is now created first and held by a small gate until the delegate returns. Without the gate, imageTaskDidStart could run on the actor before imageTaskCreated returned, so the documented order (created, then started) would stop holding. The default delegate and data tasks skip the gate.

kean added 2 commits November 1, 2026 14:24
The delegate could await the response of a task whose backing Task was not set yet, which trapped on the implicitly unwrapped optional. The Task is now created first and held by a gate until the delegate returns, which keeps imageTaskCreated ahead of imageTaskDidStart.
@kean
kean marked this pull request as draft November 1, 2026 19:26
@kean kean added this to the 14.0.1 milestone Nov 8, 2026

This branch has not been deployed

No deployments
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