balance destructor's CFRelease with a CFRetain when we get the cgfont

git-svn-id: http://skia.googlecode.com/svn/trunk@1988 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-07-28 20:36:32 +00:00
parent 1d32978f7e
commit d53bd4a40a

View File

@ -194,6 +194,10 @@ SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef fontRef) {
} else {
face = NewFromFontRef(fontRef, NULL);
SkTypefaceCache::Add(face, face->style());
// NewFromFontRef doesn't retain the parameter, but the typeface it
// creates does release it in its destructor, so we balance that with
// a retain call here.
CFRetain(fontRef);
}
SkASSERT(face->getRefCnt() > 1);
return face;