On Sep 5, 2014, at 13:31 , Jonathan Guy <jonathan...@mac.com> wrote: > The callback is basically structured like this > > __block BOOL accept; > > if ([NSThread isMainThread]) { > accept = [[Controller sharedController] shouldIAccept:certInfo]; > } > else { > dispatch_sync(dispatch_get_main_queue(), ^{ > accept = [[Controller sharedController] > shouldIAccept:certInfo]; > // This is where UI starts playing up when the > controller shows the cert > }); > } > > return accept; > > So the shouldIAccept method needs to block hence runModal. I also just threw > the window up and created my own modal loop but same problem.
It seems to me you’re *still* abusing the main thread. A dispatch_sync blocks the main thread, so it can’t be allowed to do anything that run asynchronously on the main thread (such as displaying a dialog) since that won’t complete. I suggest you approach this by denying yourself the use of dispatch_sync. I don’t know if Jens will have a better approach, but I’d be inclined to do it with a semaphore (dispatch_semaphore_t) protecting the ‘accept’ variable, and a dispatch_async to the main queue to ask the user what to do. GCD semaphores are incredibly easy to use. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com