• 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
HIThemeGetTextDimensions problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HIThemeGetTextDimensions problems


  • Subject: HIThemeGetTextDimensions problems
  • From: Tom Doan <email@hidden>
  • Date: Fri, 22 Apr 2016 15:04:13 -0500
  • Priority: normal

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: HIThemeGetTextDimensions problems
      • From: Graham Cox <email@hidden>
References: 
 >Pinning a Window to a Window (From: Dave <email@hidden>)
 >Re: Pinning a Window to a Window (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Pinning a Window to a Window
  • Next by Date: Re: BOOL parameter passed as nil object
  • Previous by thread: Re: Pinning a Window to a Window
  • Next by thread: Re: HIThemeGetTextDimensions problems
  • Index(es):
    • Date
    • Thread