On Mar 22, 2020, at 19:32:25, Sandor Szatmari
wrote:
>
>
> The only issue I see is that if this code were ever called on the main
> thread. I don’t know if this is likely because we don’t know enough about
> the OP’s code. But if there is a chance a simple test would suffice.
>
> if (
> On Mar 22, 2020, at 6:20 PM, Steve Mills via Cocoa-dev
> wrote:
>
>
>>
>> On Mar 22, 2020, at 15:38, Rob Petrovec via Cocoa-dev
>> wrote:
>>
>> I would not do this. It is widely documented that AppKit API that produce
>> UI elements, like NSOpenPanel, are _not_ thread safe.
>
> The
> On Mar 22, 2020, at 15:38, Rob Petrovec via Cocoa-dev
> wrote:
>
> I would not do this. It is widely documented that AppKit API that produce
> UI elements, like NSOpenPanel, are _not_ thread safe.
The code shown *is* threadsafe. It’s calling it on the main thread.
Steve via iPad
I would not do this. It is widely documented that AppKit API that produce UI
elements, like NSOpenPanel, are _not_ thread safe. So you may find your app
hitting some memory stomping issues or strange crashes/exceptions due to this.
Specifically what problems you will hit are anyones guess,
>
> Don't know if this helps you but you can look into dispatch_sync
> and dispatch_async.
>
Thanks a lot!
That made things very easy.
I am opening the panel now with this piece of code:
__block NSURL * user_permitted_url;
__block long int result;