Re: Why would a working -[NSInvocation invoke] call NSBeep() ?
Re: Why would a working -[NSInvocation invoke] call NSBeep() ?
- Subject: Re: Why would a working -[NSInvocation invoke] call NSBeep() ?
- From: Greg Parker <email@hidden>
- Date: Mon, 5 Dec 2011 13:14:08 -0800
On Dec 4, 2011, at 5:49 PM, Jerry Krinock wrote:
> At one point, running in Mac OS 10.7, one of my invocations gets invoked, and …
>
> #0 0x913761fa in NSBeep
> #1 0x9b6f0e1d in __invoking___
> #2 0x9b6f0d59 in -[NSInvocation invoke]
> #3 0x976458ea in __NSFireDelayedPerform
> #4 0x9b6b0996 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
> …
>
> Everything works perfectly except that the stupid beep is annoying.
>
> The invocation targets NSApplication with selector -beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:. I looked at it in gdb using "Mac OS X Debugging Magic". The target, selector, and arguments all look fine.
>
> The sheet appears before the beep. The method -[NSInvocation invoke] shows 92 lines of assembly code. It looks like, indeed, the actual invocation is done first, and then at line 41 it calls this __invoking__ thing, which is 48 lines of assembly code, and for some reason at line 15 it calls NSBeep().
>
> Does anyone have any idea why -[NSInvocation invoke] might call NSBeep()?
NSBeep() is being called by -beginSheet:modalForWindow:... . Compiler optimization ("tail-call optimization") means that the -beginSheet:... frame is absent from the stack trace.
-beginSheet:... calls NSBeep() in some error case. I don't understand the code myself, but I'd guess that it's complaining because there's already a sheet open on that window. Perhaps you're calling -beginSheet: twice, and the first call works and the second call just beeps.
You should file a bug report asking for -beginSheet:... to log a real error message or throw an exception instead of beeping.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden