<rdar://problem/6450530> WebCore::FontPlatformData should not leak
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 07:46:05 +0000 (07:46 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 07:46:05 +0000 (07:46 +0000)
Reviewed by Dan Bernstein.

Make sure we only adopt the new font, rather than re-referencing (and so leaking).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/mac/FontPlatformDataMac.mm

index 7261e70..4aff684 100644 (file)
@@ -1,3 +1,14 @@
+2009-01-01  Oliver Hunt  <oliver@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/6450530> WebCore::FontPlatformData should not leak
+
+        Make sure we only adopt the new font, rather than re-referencing (and so leaking).
+
+        * platform/graphics/mac/FontPlatformDataMac.mm:
+        (WebCore::FontPlatformData::setFont):
+
 2009-01-01  Darin Adler  <darin@apple.com>
 
         Reviewed by Dan Bernstein.
index 15e573d..30b9103 100644 (file)
@@ -86,7 +86,7 @@ void FontPlatformData::setFont(NSFont *font)
     m_font = font;
     m_size = font ? [font pointSize] : 0.0f;
 #ifndef BUILDING_ON_TIGER
-    m_cgFont = CTFontCopyGraphicsFont(toCTFontRef(font), 0);
+    m_cgFont.adoptCF(CTFontCopyGraphicsFont(toCTFontRef(font), 0));
     m_atsuFontID = CTFontGetPlatformFont(toCTFontRef(font), 0);
 #else
     m_cgFont = wkGetCGFontFromNSFont(font);