Problem With Removing Observers
Problem With Removing Observers
- Subject: Problem With Removing Observers
- From: Michael Kamprath <email@hidden>
- Date: Sat, 12 Oct 2002 13:13:36 -0700
I can create and utilize Accessibility API observers just fine, but when I
go to remove the observer with AXObserverRemoveNotification(), the
application that the observer was targeted at crashes. Is there something
special I must do to remove an observer? I don't want to always be watching
the events I am watching.
What I am doing specifically is installing a kAXMenuItemSelectedNotification
observer on the target application's UIElement (this way I get every menu
item selection). I know this is successful because I get menu item selection
notifications from the target application just fine. Then, when I am done
observing, I call AXObserverRemoveNotification() on the observer with the
target application's UIElement, and the target application crashes. The
crash log typically has this at the end of the stack crawl:
**********
Date/Time: 2002-10-12 12:32:53 -0700
OS Version: 10.2.1 (Build 6D52)
Host: claire
Command: Finder
PID: 1706
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000018
Thread 0 Crashed:
#0 0x901362b8 in CFHash
#1 0x901a40c0 in __CFDictionaryFindBuckets1b
#2 0x90142628 in CFDictionaryRemoveValue
#3 0x92d6fa2c in AXDictList::RemoveItem(void const*)
#4 0x92d8ebb8 in AXObjectList::Unregister(AXRegistrant const*)
#5 0x92d6fc80 in AXRegistry::Unregister(AXRegistrant const*)
#6 0x92cdd94c in CarbonRemoveObserverCallback
#7 0x93030eac in _axServerMessageHandler
#8 0x9016f8ac in __CFMessagePortPerform
#9 0x9015c250 in __CFRunLoopDoSource1
#10 0x90149354 in __CFRunLoopRun
#11 0x9018157c in CFRunLoopRunSpecific
#12 0x92ba34cc in RunCurrentEventLoopInMode
#13 0x92ba3c6c in GetNextEventMatchingMask
#14 0x92ba799c in WNEInternal
#15 0x92bad858 in WaitNextEvent
#16 0x00004340 in 0x4340
#17 0x00008c14 in 0x8c14
#18 0x00027cd8 in 0x27cd8
#19 0x00026d5c in 0x26d5c
#20 0x00026bdc in 0x26bdc
PPC Thread State:
srr0: 0x901362b8 srr1: 0x0200f030 vrsave: 0x00000000
xer: 0x20000000 lr: 0x901361e8 ctr: 0x901361d9 mq: 0x00000000
r0: 0x000003a0 r1: 0xbfffef70 r2: 0x48002244 r3: 0x01b32ec0
r4: 0x00000000 r5: 0xbffff020 r6: 0x0000078c r7: 0x00000000
r8: 0x0000e830 r9: 0x00000000 r10: 0x00000001 r11: 0xa2bafb28
r12: 0x901361d9 r13: 0x00000000 r14: 0x00000000 r15: 0x00000001
r16: 0x00000001 r17: 0x00000000 r18: 0x24002280 r19: 0x00000000
r20: 0x00005417 r21: 0x00000000 r22: 0x01b32ea4 r23: 0x00000000
r24: 0x0274d4e0 r25: 0xa30003b8 r26: 0x014c9b80 r27: 0x01b32ec0
r28: 0x01b32e80 r29: 0x01b32ec0 r30: 0x003b5790 r31: 0x901361e8
**********
It crashes similarly for Cocoa apps too. Are there any "gotchas" associated
with removing obnservers?
Michael F. Kamprath
email@hidden
Keyboard Maestro - Conduct Your Mac Like a Pro!
Download a free copy today at: www.KeyboardMaestro.com
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.