Huh, maybe this has been true since June 2023? Am I really so behind the times? (NSImage being Transferable makes sense, but Sendable is surprising) https://developer.apple.com/documentation/updates/appkit?#Swift-and-SwiftUI
AppKit updates | Apple Developer Documentation

Learn about important changes to AppKit.

Apple Developer Documentation

@cocoaphony I don’t think so. The bullet point I think(!) you’re quoting only talks about NSImage being Transferable and some other types being Sendable, doesn’t it? I can’t find any other relevant NSImage reference in that document.

“AppKit more fully integrates with Swift and SwiftUI with Sendable (NSColor, NSColorSpace, NSGradient, NSShadow, NSTouch) and Transferable (NSImage, NSColor, NSSound) types.”

@ole yeah, I think it’s a bug. It is being treated as Sendable and can use that to violate thread safety and crash. I’m going to put together a bug report.
@cocoaphony Yeah, I saw your crashing code snippet. I only wanted to comment on the “since June 2023” question. I don’t think the AppKit updates page says this, so you aren’t years behind.
@cocoaphony @ole We know about it. The Transferable protocol gained a Sendable conformance and that made NSImage Sendable unintentionally. It is not concurrency-safe (but works fine on arbitrary threads if isolated). The only tenable fix at this point will be to make it safe, but that’s easier said than done on a reference type with mutable state inside.
@jnadeau @ole it seems at least a documentation fix is warranted. If it weren’t for me saying “there’s no way that’s right” and writing tests to prove it, we definitely would have used it unsafely, but probably couldn’t have discovered the problem through normal unit testing, just field crashes.