Re: [Repost] Various AXObserver questions
Re: [Repost] Various AXObserver questions
- Subject: Re: [Repost] Various AXObserver questions
- From: Matt Gough <email@hidden>
- Date: Tue, 18 Mar 2003 16:20:21 +0000
>
Please be more clear on what you mean by re-entrant. The callbacks are
>
serialized so they willo not be re-entered. Are you asking if you can make
>
other AX calls inside of the callback, then the answer is:
>
>
1) not a good idea on 10.2.x
>
2) yes in the next major release.
Hmm, so inside my kAXWindowCreatedNotification you are saying it is a bad
idea to ask the app for its list of windows and parse their info. Sounds a
bit limiting. (What I'm doing hasn't caused any trouble so far. Am I just
being lucky?)
>
>
>
> 3. I assume that AXObserverRemoveNotification doesn't need calling unless I
>
> want to explicitly stop observing something that is still going to be
>
> around. (in the same way you don't need to unregister Carbon Events on
>
> windows when they are disposed.)
>
>
You do not have to remove observers, but in a sense you will be leaking
>
memory. There is a data structure in the API which holds the
>
AXUIElementRef, the notification, and the refcon. If you do not either
>
CFRelease the observer or remove the particular notification, then these
>
will hang around for ever.
in that case, is it OK to AXObserverRemoveNotification from within the
Observer Callback itself?
E.g.
void
ObserverCallback(
AXObserverRef observer,
AXUIElementRef element,
CFStringRef notification,
void* refCon)
{
#pragma unused(observer, element, notification)
if (CFEqual(notification, kAXUIElementDestroyedNotification))
AXObserverRemoveNotification(observer, element, notification);
}
Matt
_______________________________________________
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.