How to release CTFramesetter?

I use CoreText in my application and I have a really huge leak, but I can not understand why this is happening. so here is a snippet of my code:

_framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)_mAttributedString); CFDictionaryRef frameOptionsDictionary = (CFDictionaryRef)[self frameOptionsDictionary]; _frame = CTFramesetterCreateFrame(_framesetter, CFRangeMake(0, _mAttributedString.length), path, frameOptionsDictionary); CFRelease(_framesetter), _framesetter = NULL; 

As you can see, I am releasing a CTFramesetter ... but application leaks and tools show me that CTFramesetter is causing this. So how do I let him go?

+1
ios objective-c core-graphics core-text
source share
1 answer

0) ensure no failures:

 assert(_mAttributedString); assert(0 == _framesetter); _framesetter = CTFramesetterCreateWithAttributedString( (CFAttributedStringRef)_mAttributedString); CFDictionaryRef frameOptionsDictionary = (CFDictionaryRef)[self frameOptionsDictionary]; assert(path); assert(0 == _frame); _frame = CTFramesetterCreateFrame(_framesetter, CFRangeMake(0, _mAttributedString.length), path, frameOptionsDictionary); CFRelease(_framesetter), _framesetter = NULL; 
0
source share

All Articles