Don't know if this helps you but you can look into dispatch_sync
and  dispatch_async.

Cheers

On Sat, Mar 21, 2020 at 9:16 PM Sandor Szatmari via Cocoa-dev <
[email protected]> wrote:

> You must run the panel on the main thread.
>
> Sandor
>
> > On Mar 21, 2020, at 3:05 PM, Gabriel Zachmann via Cocoa-dev <
> [email protected]> wrote:
> >
> > Is it possible to open an NSOpenPanel in a secondary thread?
> >
> > I create the thread like this:
> >
> >        directoryScanThread_ = [[NSThread alloc] initWithTarget: self
> >                                                       selector:
> @selector(scanDirectory:)
> >                                                         object: nil];
> >        [directoryScanThread_ start];
> >
> >
> > But when I do:
> >
> >    NSOpenPanel *oPanel = [NSOpenPanel openPanel];
> >
> > it crashes at this point.
> >
> > In the docs, I found a hint that one should use
> >
> >    lockFocusIfCanDraw
> >
> > but that is deprecated now.
> >
> > Any ideas will be highly appreciated.
> >
> >
> > Best regards, Gabriel
> >
> >
> > _______________________________________________
> >
> > Cocoa-dev mailing list ([email protected])
> >
> > 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:
> >
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> >
> > This email sent to [email protected]
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/bpantazhs%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to