[Webkit-unassigned] [Bug 21322] DumpRenderTree pixel test improvements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 23 12:59:25 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=21322





------- Comment #29 from aroben at apple.com  2008-10-23 12:59 PDT -------
(In reply to comment #28)

> > +    CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); // Use ARGB8 on PPC or BGRA8 on X86 to improve CG performance
> > +    if (!context) {
> > +        free(buffer);
> > +        return 0;
> >      }
> >  
> > -    [NSGraphicsContext setCurrentContext:savedContext.get()];
> > -}
> > +    // The BitmapContext keeps the CGContextRef and the pixel buffer alive
> > +    RefPtr<BitmapContext> bitmapContext = BitmapContext::create(buffer, context);
> 
> I believe you're leaking the CGContext here. BitmapContext retains the context
> you pass in, so you need to call CGContextRelease to balance the
> CGBitmapContextCreate.

Dan has pointed out to me that BitmapContext's constructor adopts the
CGContext. I think that is quite confusing (as he said in comment 21). I think
it would be clearer to get rid of the adoption in the constructor and just add
a release at the callsites.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list