Re: run loop problem (i think)
Re: run loop problem (i think)
- Subject: Re: run loop problem (i think)
- From: Bob Ippolito <email@hidden>
- Date: Thu, 12 May 2005 20:17:11 -0400
On May 11, 2005, at 6:29 PM, Ken Victor wrote:
given the following (summary)in my main thread:
[NSThread detachNewThreadSelector: @selector(doSteps:)
toTarget: self
withObject: nil];
[NSApp runModalForWindow: [controller window]];
and
- (void) doSteps: (id) unused {
NSAutoreleasePool* arp = [[NSAutoreleasePool alloc] init];
...
[NSApp performSelectorOnMainThread: @selector(stopModal)
withObject: nil
waitUntilDone: NO];
[arp release];
}
ie, i start a thread and then run a modal window. the last thing my
thread does before returning is to call NSApp stopModal (and then
releases its aur release pool).
the problem is that my code following the call to runModalForWindow
doesn't execute until i click the mouse or type a key on the keyboard.
(note that i've tried calling stopModal directly in my thread as
opposed to via performSelectorOnMainThread and it doesn't solve the
problem. i've also unsuccessfully tried pass YES as the
waitUntilDone argument.)
can anyone give me any ideas as to what is causing this behavior,
or more importantly how i can avoid it?
It might be running in a different mode (probably
NSModalPanelRunLoopMode) when you have a modal run loop up, try using
performSelectorOnMainThread:withObject:waitUntilDone:modes: instead
and specify [NSArray arrayWithObjects: NSModalPanelRunLoopMode,
NSDefaultRunLoopMode, nil] for the modes and see if that helps.
-bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden