Hello, 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? Part of stack trace of crashed thread: <skipped and crash here> 19 com.apple.AppKit 0x915e8d40 -[NSWindow displayIfNeeded] 204 20 com.apple.Foundation 0x93b6d9d5 __NSFireDelayedPerform 537 21 com.apple.CoreFoundation 0x95634adb __CFRunLoopRun 8059 22 com.apple.CoreFoundation 0x95632464 CFRunLoopRunSpecific 452 23 com.apple.CoreFoundation 0x95632291 CFRunLoopRunInMode 97 24 com.apple.Foundation 0x93be6805 -[NSConcreteTask waitUntilExit] 273 <skipped> NSTask launching code: // create task and pipe objects NSTask *task = [[NSTask alloc] init]; NSPipe *outputPipe = [[NSPipe alloc] init]; NSPipe *errorPipe = [[NSPipe alloc] init]; // setup binary and arguments [task setLaunchPath:cmd]; [task setStandardOutput:outputPipe]; // and all error output goes to our pipe, not console [task setStandardError:errorPipe]; [task setArguments:args]; // launch task [task launch]; [task waitUntilExit]; [[errorPipe fileHandleForReading] closeFile]; [[outputPipe fileHandleForReading] closeFile]; terminationStatus = [task terminationStatus]; [task terminate]; // just in case Thanks for your help, Vera Tkachenko_______________________________________________ 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