Bug 10836 - REGRESSION: Mac implementation of Font::drawGlyphs leaks a CGColorRef
Summary: REGRESSION: Mac implementation of Font::drawGlyphs leaks a CGColorRef
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: EasyFix, Regression
Depends on:
Blocks:
 
Reported: 2006-09-13 06:27 PDT by Mark Rowe (bdash)
Modified: 2006-09-13 21:48 PDT (History)
0 users

See Also:


Attachments
Patch (2.27 KB, patch)
2006-09-13 15:24 PDT, Mark Rowe (bdash)
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rowe (bdash) 2006-09-13 06:27:56 PDT
Line 594 of FontMac.mm (http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/platform/mac/FontMac.mm#L594) contains a call to cgColor(context->pen().color()) as part of the arguments of a function call.  The CGColorRef returned by cgColor is retained and needs to be released to prevent it from being leaked.  It seems as though Font::drawComplexText (line 485) has the same problem.

This leak shows up in the Buildbot output at http://build.webkit.org/results/post-commit-leaks-powerpc-mac-os-x/2531/DumpRenderTree5-leaks.txt.
Comment 1 Mark Rowe (bdash) 2006-09-13 15:24:52 PDT
Created attachment 10548 [details]
Patch
Comment 2 Eric Seidel (no email) 2006-09-13 15:49:08 PDT
Comment on attachment 10548 [details]
Patch

My mistake, thanks for fixing.

You might add a:
 // WebCore expects text to respect the pen color, CG expects text to use fill

comment to the other place as well, I had meant to do that originally.

Also, this makes me wonder if it wouldn't be a better idea to set the color on the context with 4 floats to prevent the malloc/free associated with creating a color and freeing...  If it shows up in shark we'll have to move to that model.

r=me
Comment 3 Mark Rowe (bdash) 2006-09-13 21:48:03 PDT
Landed in r16356.