On Sep 19, 2012, at 12:17 PM, Kyle Sluder <k...@ksluder.com> wrote: > I think AppleScript might be a red herring here. We're seeing a similar > slowdown in use of NSOpenPanel in our apps.
We filed a radar on this problem this afternoon, rdar://12342164. It's in open radar as well. Here's the key bit of the description: >> AppKit uses the private class NSLocalWindowWrappingRemoteWindow to shove the >> open sheet into our window but redirect to Power Box for the internals. >> >> When the user clicks cancel or open in the open sheet, the sheet loses key, >> and AppKit revalidates all the toolbar items. The >> NSLocalWindowWrappingRemoteWindow instance is still in the responder chain >> at this point. >> >> We're using a custom target-selection mechanism, called OATargetSelection. >> OATargetSelection is triggered by an override of -[NSApplication >> targetForAction:to:from:]. That mechanism traverses the responder chain from >> the first responder of the key window and the main window. It also checks >> things like delegates, window controllers, >> and---crucially---supplementalTargetForAction. >> >> OATargetSelection calls supplementalTargetForAction on the >> NSLocalWindowWrappingRemoteWindow instance. >> NSLocalWindowWrappingRemoteWindow's supplementalTargetForAction dispatches >> to the Power Box instance, which doesn't respond. It's busy going away. The >> IPC call times out in 300 ms, supplementalTargetForAction returns nil, and >> we merrily chase the rest of the responder chain. >> >> Debugging shows that the time out occurs in _dispatch_semaphore_wait_slow, >> which is tail-called by dispatch_semaphore_wait. The time-out argument to >> dispatch_semaphore_wait is generated by a call to dispatch_time with a >> time-out offset of 300,000,000 nanoseconds. That matches the 300 ms delay we >> observe. Further the return code of _dispatch_semaphore_wait_slow is 49, >> indicating a time-out. >> >> This time-out delay happens for every validation. After the four seconds >> that this consumes, the sheet finally leaves the responder chain, our >> completion handler for the open sheet is called, and the UI becomes >> responsive again. Unfortunately we haven't found a workaround. All notifications and override points that we've tried are invoked after the time outs occur. Cheers, Curt ----------------------------------------------------------------------------- Curt Clifton, PhD Software Engineer The Omni Group www.curtclifton.net _______________________________________________ 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