While doing some cleanup of memory problems on our software, I 
discovered that HIThemeGetTextDimensions seemed to be leaking memory. 
(At minimum, it seemed to be allocating a CFString and a CFDictionary and 
never fully releasing them). This seems to be an old Carbon-era function 
which is poorly documented and has been a probably even before I found 
that it was leaking. (We have a multi-threaded application and it seems it 
doesn't work properly unless run on the main thread, which never made any 
real sense). Is there a more modern and well-behaved alternative to this? I 
can't seem to find one.


(Code in which it's used)

-(IBAction) textsize:(id) view
{
    CGFloat                     cgwidth;
    HIThemeTextInfo textinfo;
    textinfo.version = 1;
    textinfo.state   = kThemeStateActive;
    textinfo.fontID  = kThemeSystemFont;
    textinfo.horizontalFlushness = kHIThemeTextHorizontalFlushLeft;
    textinfo.verticalFlushness   = kHIThemeTextVerticalFlushCenter;
    textinfo.options             = 0;
    textinfo.truncationPosition  = kHIThemeTextTruncationNone;
    textinfo.truncationMaxLines  = 1;
    HIThemeGetTextDimensions(itsString,0,&textinfo,&cgwidth,NULL,NULL);
    itsWidth = cgwidth;
}

Best regards,

Tom Doan
Estima
---
1560 Sherman Ave #1029
Evanston, IL 60201
USA

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to