Here is my backtrace:
frame #0: 0x00000001000195b8 AXUITester`axObserverCallback + 24 at MyTestClass.m:66 frame #1: 0x00007fff87216f89 HIServices`_XXMIGPostNotification + 904 frame #2: 0x00007fff8722708a HIServices`_XPostNotification + 618 frame #3: 0x00007fff871fff1a HIServices`mshMIGPerform + 564 frame #4: 0x00007fff83909abc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 44 frame #5: 0x00007fff839097eb CoreFoundation`__CFRunLoopDoSource1 + 155 frame #6: 0x00007fff8393ff27 CoreFoundation`__CFRunLoopRun + 1895 frame #7: 0x00007fff8393f486 CoreFoundation`CFRunLoopRunSpecific + 230 frame #8: 0x00007fff86718f7b Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267 frame #9: 0x00007fff8679cb56 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 66 frame #10: 0x0000000100002b5f AXUITester`-[PCAppDelegate reload:] + 2303 at PCAppDelegate.m:123 frame #11: 0x0000000100001c44 AXUITester`-[PCAppDelegate applicationDidFinishLaunching:] + 52 at PCAppDelegate.m:34 frame #12: 0x00007fff86723d0e Foundation`__-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47 frame #13: 0x00007fff839537ba CoreFoundation`_CFXNotificationPost + 2634 frame #14: 0x00007fff8670ffc3 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 65 frame #15: 0x00007fff82b71e2b AppKit`-[NSApplication _postDidFinishNotification] + 212 frame #16: 0x00007fff82b71b91 AppKit`-[NSApplication _sendFinishLaunchingNotification] + 78 frame #17: 0x00007fff82b70858 AppKit`-[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 242 frame #18: 0x00007fff82b705b9 AppKit`-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 330 frame #19: 0x00007fff8399d541 CoreFoundation`-[NSObject performSelector:withObject:withObject:] + 65 frame #20: 0x00007fff867467c7 Foundation`__-[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]_block_invoke_1 + 101 frame #21: 0x00007fff8674574e Foundation`-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 283 frame #22: 0x00007fff867455dc Foundation`_NSAppleEventManagerGenericHandler + 105 frame #23: 0x00007fff86260c25 AE`aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 200 frame #24: 0x00007fff86260b03 AE`_ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 38 frame #25: 0x00007fff862609f7 AE`aeProcessAppleEvent + 250 frame #26: 0x00007fff8b93db69 HIToolbox`AEProcessAppleEvent + 102 frame #27: 0x00007fff82b6d9c5 AppKit`_DPSNextEvent + 1247 frame #28: 0x00007fff82b6d07d AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135 frame #29: 0x00007fff82b699b9 AppKit`-[NSApplication run] + 470 frame #30: 0x00007fff82de5eac AppKit`NSApplicationMain + 867 frame #31: 0x0000000100001b82 AXUITester`main + 34 at main.m:13 frame #32: 0x0000000100001b54 AXUITester`start + 52
On Apr 3, 2013, at 8:43 AM, Eric Schlegel wrote: On Apr 2, 2013, at 2:24 PM, Patrick Cusack < email@hidden> wrote: I am observing my application process looking for an kAXMenuOpenedNotification when I open a contextual menu. I do see the callback for the notification, but it is only after I click away and close the menu. Would anyone have an explanation as to why the menu notification is delayed?
I suspect the runloop needs to be running in the default mode for your notification to be received. Since you're observing the notification in your own process, and menu tracking runs the runloop in a custom mode while the menu is open, the notification is probably delayed until after the menu closes and the runloop resumes running in the default mode.
It would be easier to tell if this is correct if you posted the backtrace that you see in the debugger when your breakpoint on your callback is hit.
-eric
|