NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Hey, I'm trying to display an NSOpenPanel on a dispatch, with half-luck. The panel displays, but no files going to be displayed - the circle just spinning on the bottom-left corner. Anyone have an idea what going wrong? Thanks, Tamas dispatch_async(dispatch_get_main_queue(), ^{

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tom Davie
On 16 Dec 2012, at 10:45, Tamas Nagy wrote: > Hey, > > I'm trying to display an NSOpenPanel on a dispatch, with half-luck. The panel > displays, but no files going to be displayed - the circle just spinning on > the bottom-left corner. Anyone have an idea what going wrong? > > Thanks, > > T

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Thanks for the suggestions Tom. I know about that things, but the original code was a bit bigger, where I need a mutable array and other stuff, and just trimmed out for the example. But to back to on-topic: the code works fine on 10.6.8, the issue happens only on 10.7.5 and 10.8.2. If I call th

Re: blocks and id

2012-12-16 Thread Andreas Grosam
On 15.12.2012, at 01:44, Uli Kusterer wrote: > > On 15.12.2012, at 01:38, Uli Kusterer wrote: > >> On 12.12.2012, at 10:03, Andreas Grosam wrote: >>> How can I check at runtime whether an object (id) is actually a block, and >>> not another kind of object? >> >> Not a good idea. What are yo

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Mike Abdullah
On 16 Dec 2012, at 10:45, Tamas Nagy wrote: > Hey, > > I'm trying to display an NSOpenPanel on a dispatch, with half-luck. The panel > displays, but no files going to be displayed - the circle just spinning on > the bottom-left corner. Anyone have an idea what going wrong? > > Thanks, > > Ta

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Unfortunately that doesn't help. I think the issue should be related to dispatches, because it won't happen if I just call performSelectorOnMainThread... On Dec 16, 2012, at 6:05 PM, Mike Abdullah wrote: > > On 16 Dec 2012, at 10:45, Tamas Nagy wrote: > >> Hey, >> >> I'm trying to display

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Dec 16, 2012, at 2:45 AM, Tamas Nagy wrote: > >dispatch_async(dispatch_get_main_queue(), ^{ > >NSOpenPanel *oPanel = [NSOpenPanel openPanel]; *Bzzt!* Thou shalt not do UI work on a background thread. You cannot use dispatch_async here. --Kyle Sluder ___

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Mike Abdullah
On 16 Dec 2012, at 18:32, Kyle Sluder wrote: > On Dec 16, 2012, at 2:45 AM, Tamas Nagy wrote: > >> >> dispatch_async(dispatch_get_main_queue(), ^{ >> >> NSOpenPanel *oPanel = [NSOpenPanel openPanel]; > > *Bzzt!* Thou shalt not do UI work on a background thread. You cannot use > disp

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Mike Abdullah
On 16 Dec 2012, at 17:20, Tamas Nagy wrote: > Unfortunately that doesn't help. > > I think the issue should be related to dispatches, because it won't happen if > I just call performSelectorOnMainThread... Can you post that variant of your code then, please?

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Dec 16, 2012, at 10:39 AM, Mike Abdullah wrote: > > On 16 Dec 2012, at 18:32, Kyle Sluder wrote: > >> On Dec 16, 2012, at 2:45 AM, Tamas Nagy wrote: >> >>> >>> dispatch_async(dispatch_get_main_queue(), ^{ >>> >>> NSOpenPanel *oPanel = [NSOpenPanel openPanel]; >> >> *Bzzt!* Thou s

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Sun, Dec 16, 2012, at 10:40 AM, Mike Abdullah wrote: > > On 16 Dec 2012, at 17:20, Tamas Nagy wrote: > > > Unfortunately that doesn't help. > > > > I think the issue should be related to dispatches, because it won't happen > > if I just call performSelectorOnMainThread... > > Can you post

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Sun, Dec 16, 2012, at 11:28 AM, Kyle Sluder wrote: > My guess is that NSOpenPanel is doing some work on a background thread, > and that work is trying to use the main queue to inform the open panel > of its completion. By using the dispatch_async approach, the main queue > is blocked, and the ba

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Thanks for the approach Kyle, but dispatch_async performs asynchronously, so it should not block the main thread. I fallback to performSelectorOnMainThread: method in my app, but the dispatch way is a bit straightforward in my opinion. I'll fill a rdar on this. On Dec 16, 2012, at 8:39 PM,

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tom Davie
Performing asynchronously and blocking the main *queue* are not related things. The main queue is a serial queue, it only executes one block at a time. At the moment, it's executing your block, stuck in your runModal call. That runModal call will not come off the stack, and the block finish ex

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Ahh, okay, thanks for the explanation Tom, now I got it. On Dec 16, 2012, at 9:21 PM, Tom Davie wrote: > Performing asynchronously and blocking the main *queue* are not related > things. > > The main queue is a serial queue, it only executes one block at a time. At > the moment, it's executi

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Sun, Dec 16, 2012, at 12:04 PM, Tamas Nagy wrote: > Thanks for the approach Kyle, but dispatch_async performs asynchronously, > so it should not block the main thread. I fallback to > performSelectorOnMainThread: method in my app, but the dispatch way is a > bit straightforward in my opinion. I'

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Sun, Dec 16, 2012, at 12:04 PM, Tamas Nagy wrote: > Thanks for the approach Kyle, but dispatch_async performs asynchronously, > so it should not block the main thread. I fallback to > performSelectorOnMainThread: method in my app, but the dispatch way is a > bit straightforward in my opinion. I'

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Mike Abdullah
On 16 Dec 2012, at 20:04, Tamas Nagy wrote: > Thanks for the approach Kyle, but dispatch_async performs asynchronously, so > it should not block the main thread. I fallback to > performSelectorOnMainThread: method in my app, but the dispatch way is a bit > straightforward in my opinion. I'll f

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Rob Petrovec
On Dec 16, 2012, at 9:05 AM, Mike Abdullah wrote: > > On 16 Dec 2012, at 10:45, Tamas Nagy wrote: > >> Hey, >> >> I'm trying to display an NSOpenPanel on a dispatch, with half-luck. The >> panel displays, but no files going to be displayed - the circle just >> spinning on the bottom-left cor

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
Thanks Kyle. I know about beginWithCompletionHandler: , but I really need a modal window at that point my application opens the open panel. On Dec 16, 2012, at 9:39 PM, Kyle Sluder wrote: > On Sun, Dec 16, 2012, at 12:04 PM, Tamas Nagy wrote: >> Thanks for the approach Kyle, but dispatch_asyn

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Kyle Sluder
On Sun, Dec 16, 2012, at 09:43 PM, Tamas Nagy wrote: > Thanks Kyle. I know about beginWithCompletionHandler: , but I really need > a modal window at that point my application opens the open panel. I have to ask, why? If you want to block interaction with a document, you can use -beginSheetModalFo

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tamas Nagy
It's a live video app, where rendering happening on a CVDisplayLink thread, so the app still running and do its job while an OpenPanel (or SavePanel) displaying. I just need to block the UI to make sure the users can't interact the app while an open panel displaying. On Dec 17, 2012, at 6:46 A