Bug 10836

Summary: REGRESSION: Mac implementation of Font::drawGlyphs leaks a CGColorRef
Product: WebKit Reporter: Mark Rowe (bdash) <mrowe>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: EasyFix, Regression
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch eric: review+

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.