mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
CloudKitRecordMapper was a standalone actor, so 'await recordMapper.toCKRecord' from the @MainActor sync engine hopped off the main actor and read live SwiftData @Model properties (e.g. LocalPlaylistItem.authorName) from the wrong executor. SwiftData models are bound to the main ModelContext and are not thread-safe, so this raced the backing store and crashed with EXC_BAD_ACCESS. Make the mapper @MainActor (it must touch main-isolated models regardless) and drop the now-redundant awaits. Fixes the crash for all synced model types. Fixes an EXC_BAD_ACCESS seen in TestFlight build 261.