Re: [Repost] Various AXObserver questions
Re: [Repost] Various AXObserver questions
- Subject: Re: [Repost] Various AXObserver questions
- From: John Louch <email@hidden>
- Date: Tue, 18 Mar 2003 08:28:34 -0800
>
> 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?)
This is fairly safe. If you are receiving many notifications, and then you
call back to the process that is trying to server you the routine that you
are calling could fail (timeout kAXErrorCannotComplete) and the notification
from the process could fail as well.
>
>
>>
>
>> 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);
>
}
>
Yes that should be ok.
>
>
Matt
>
---------------------------------------------
John Louch Internet #: email@hidden
(805) 546 0216
_______________________________________________
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.