manfred
(Manfred Schubert)
1
With code like the following:
import Cocoa
let window = NSWindow()
Task.detached {
let error = NSError()
await window.presentError(error,
modalFor: window,
delegate: nil,
didPresent: nil,
contextInfo: nil)
}
I get the following warning for contextInfo:
"Passing argument of non-sendable type 'UnsafeMutableRawPointer?' into main actor-isolated context may introduce data races"
How can I fix this? I don't see how passing nil here can cause any data races.
hborla
(Holly Borla)
2
It doesn't! This is a case where code that obviously can't race is diagnosed by Sendable checking. This will be resolved by SE-0414: Region-based isolation. You should not need to change this code.
2 Likes
manfred
(Manfred Schubert)
3
OK, thanks!
Region-based isolation will then also take care of the case when I would actually want to pass any context info on, if I read correctly, so this is good.