fix(m9): clear printTask without defer for Swift 5.7 (#113) #114

Merged
gronod merged 1 commits from feat/113-printtask-defer-swift57 into milestone/m9-monterey 2026-09-12 09:01:39 +01:00
Owner

Fixes #113.

Run 31978 got past the ViewBuilder limit but failed at the next Swift 5.7-only diagnostic:

PrintSessionViewModel.swift:113:26: error: main actor-isolated property 'printTask' can not be mutated from the main actor
PrintSessionViewModel.swift:144:26: same

Swift 5.7 treats defer bodies as a separate nonisolated context, so defer { self.printTask = nil } inside the @MainActor task closures is an error. Fix: clear printTask explicitly at each exit point (error return + normal completion in printAllPages; end of closure in printPage). Audited: these were the only defer { self.* = } mutations in the tree.

Verified locally: xcodebuild build -scheme ICCery succeeds.

Fixes #113. Run 31978 got past the ViewBuilder limit but failed at the next Swift 5.7-only diagnostic: ``` PrintSessionViewModel.swift:113:26: error: main actor-isolated property 'printTask' can not be mutated from the main actor PrintSessionViewModel.swift:144:26: same ``` Swift 5.7 treats `defer` bodies as a separate nonisolated context, so `defer { self.printTask = nil }` inside the `@MainActor` task closures is an error. Fix: clear `printTask` explicitly at each exit point (error return + normal completion in `printAllPages`; end of closure in `printPage`). Audited: these were the only `defer { self.* = }` mutations in the tree. Verified locally: `xcodebuild build -scheme ICCery` succeeds.
gronod added the
Priority
High
2
Project/ICCery-v2Bug/UI
labels 2026-09-12 09:01:01 +01:00
gronod added 1 commit 2026-09-12 09:01:02 +01:00
Swift 5.7 on the macOS 12 CI runner (Xcode 14.2) rejects mutation of
actor-isolated properties inside defer bodies, failing run 31978 at
PrintSessionViewModel.swift:113 and :144. Clear printTask explicitly at
each exit point of the print task closures.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
gronod merged commit 2295bcdbae into milestone/m9-monterey 2026-09-12 09:01:39 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gronod/iccery-v2-mac#114