PrintSessionViewModel: defer cannot mutate @MainActor state on Swift 5.7 (run 31978) #113

Closed
opened 2026-09-12 09:00:37 +01:00 by gronod · 0 comments
Owner

Run 31978 (job 33224) failed at Build for testing (universal) on the macos-12 runner (Xcode 14.2 / Swift 5.7):

PrintSessionViewModel.swift:113:26: error: main actor-isolated property 'printTask' can not be mutated from the main actor
    defer { self.printTask = nil }
PrintSessionViewModel.swift:144:26: same error

Swift 5.7 rejects mutation of actor-isolated properties inside defer bodies (treated as a separate nonisolated context); newer compilers handle it. Fix: clear printTask explicitly at each exit point of the task closures instead of via defer.

Run 31978 (job 33224) failed at `Build for testing (universal)` on the macos-12 runner (Xcode 14.2 / Swift 5.7): ``` PrintSessionViewModel.swift:113:26: error: main actor-isolated property 'printTask' can not be mutated from the main actor defer { self.printTask = nil } PrintSessionViewModel.swift:144:26: same error ``` Swift 5.7 rejects mutation of actor-isolated properties inside `defer` bodies (treated as a separate nonisolated context); newer compilers handle it. Fix: clear `printTask` explicitly at each exit point of the task closures instead of via `defer`.
gronod added the
Priority
High
2
Project/ICCery-v2Bug/UI
labels 2026-09-12 09:00:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gronod/iccery-v2-mac#113