On Apr 26, 2011, at 2:55 AM, Vera Tkachenko wrote: > In my app I need to determine if some app if properly codesigned. To do this > I just invoke "/usr/bin/codesign" and analyse return value. To invoke it I > use NSTask and launch it in background thread. Everything works fine excepts > strange crash I get sometimes from our customers. While NSTask is waiting for > command to finish (waitUntilExit) UI starts to update in background thread... > which causes crashes. I now that's improper to do any UI related stuff in > background threads. And I don't force UI update explicitly. > > But why it's get updated while waiting?
-[NSTask waitUntilExit] runs the current thread's run loop in the default mode. Because of this, it is kind of dangerous -- it will service any input sources, timers, delayed performSelector... invocations, etc. that are scheduled in the default mode. Now, the normal way to work around this is to run it on a secondary thread where you have a degree of control over what is scheduled on the run loop. That's what you are doing, apparently. So, the question is: what is scheduling a timer or delayed performSelector... on that thread's run loop? It is either some of your own code, or you are invoking something in Cocoa which does that as a side effect. Perhaps something is invoking one of the -setNeedsDisplay... methods of an NSView, which might implicitly schedule -[NSWindow displayIfNeeded] onto the thread's run loop. Regards, Ken _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com