Re: NSAlert & NSOpenPanel on a background thread
Re: NSAlert & NSOpenPanel on a background thread
- Subject: Re: NSAlert & NSOpenPanel on a background thread
- From: edward taffel <email@hidden>
- Date: Thu, 22 May 2014 11:54:38 -0400
On May 22, 2014, at 11:41 AM, Jens Alfke <email@hidden> wrote:
>
> On May 22, 2014, at 8:29 AM, edward taffel <email@hidden> wrote:
>
>> this i have remedied. however, given the scenario where a url has vanished, i first show an NSAlert & then an NSOpenPanel to offer relink. NSOpenPanel causes no such background thread issue: do the two have variant thread safety? or is this likely to change in the future for NSOpenPanel, as well?
>
> I suspect NSOpenPanel just doesn’t have special code to detect misuse. It probably happens so often with NSAlert that they added a warning for it.
>
> In general, you shouldn’t call _any_ AppKit code from a background thread. Ditto for any other UI-level framework that uses AppKit. (There are some exceptions, like working with offscreen NSImages, but in general the Apple API docs will tell you when an API is thread-safe.)
i find no mention of thread safety in the NSOpenPanel doc, but the doc mentions ‘Open panels are drawn in a separate process by the powerbox’: perhaps this is the reason.
>
> —Jens
thanks for your advice, jens.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden