Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Quincey Morris
On Sep 26, 2017, at 08:19 , Jens Alfke wrote: > > You’re assuming it’s a synthesized getter, but there’s no reason it couldn’t > be a custom method that does arbitrary computation before returning the > value, and there’s no way to know whether that work is thread-safe or not. It is, in a sens

Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Jens Alfke
> On Sep 26, 2017, at 1:16 AM, Tamas Nagy wrote: > > “state” of the NSButton is a NSInteger property, so that should be safe to > read from a background thread, right? No. You can’t tell anything about a property’s implementation from its return type. You’re assuming it’s a synthesized gette

Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Gary L. Wade
If you have an issue with one API reporting such an issue, write a radar, as I did for getting the application’s delegate when I encountered it. For a button’s state, however, there may be a better way to pass that value to a background thread, especially if the button should be setting a value

Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Tamas Nagy
Makes sense, thanks Quincey. Best, Tamas > On 2017. Sep 26., at 10:35, Quincey Morris > wrote: > > On Sep 26, 2017, at 01:16 , Tamas Nagy > wrote: >> >> but “state” of the NSButton is a NSInteger property, so that should be safe >> to read from a background

Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Quincey Morris
On Sep 26, 2017, at 01:16 , Tamas Nagy wrote: > > but “state” of the NSButton is a NSInteger property, so that should be safe > to read from a background thread, right? Not necessarily. If the setter is thread-unsafe, then it’s possible that the getter may retrieve an incorrect value. It’s no

[NSButton state] must by used from the main thread

2017-09-26 Thread Tamas Nagy
Hi there, XCode 9’s new main thread checker feature found the possible issue mentioned on the subject line. Indeed there is a background thread that check’s the state of an NSButton subclass, but I’m wondering if this is a real issue - I understand the problems with changing the UI from a backg