• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps


  • Subject: Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
  • From: Bill Cheeseman <email@hidden>
  • Date: Thu, 11 Nov 2010 08:21:53 -0500


On Nov 11, 2010, at 7:04 AM, Peter Lübke wrote:

- (id)valueForAttributeCopy:(CFStringRef)attribute
{
id value = nil;
id axValue = nil;
NSArray *attrNames;

if (AXUIElementCopyAttributeNames((CFTypeRef)_element, (CFArrayRef *)&attrNames) == kAXErrorSuccess)
{
if ( [attrNames indexOfObject:(NSString *)attribute] != NSNotFound && AXUIElementCopyAttributeValue((CFTypeRef)_element, attribute, (CFTypeRef *)&axValue) == kAXErrorSuccess )
value = axValue;
}
[attrNames release];

return value;
}

I believe it's OK to cast a CFTypeRef to a toll-free-bridged NSObject and then 'release' or 'autorelease' it instead of 'CFReleas'ing it.

However, you have neglected to CFRelease (or release, or autorelease) the value stored in axValue by the AXUIElementCopyAttributeValue() function call in the body of your method The Cocoa convention is that a method like your -valueForAttributeCopy: always returns an object autoreleased. So, you might want to add '[axValue autorelease]' or '[value autorelease]' before the return, or change the last line to 'return [value autorelease]', and see what happens. (If the caller of your method does releases its return value when done with it, remove that release because it would be automatically released by the autorelease added in your method).

--

Bill Cheeseman - email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
      • From: Christiaan Hofman <email@hidden>
References: 
 >Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps (From: Bill Cheeseman <email@hidden>)
 >Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps (From: Peter Lübke <email@hidden>)

  • Prev by Date: Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
  • Next by Date: Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
  • Previous by thread: Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
  • Next by thread: Re: Performance slowdown when traversing UIElements under menu bar of Mail and some other apps
  • Index(es):
    • Date
    • Thread