[webkit-reviews] review granted: [Bug 211160] REGRESSION (r260407): Over-release of NSGraphicsContext in WebKit::convertPlatformImageToBitmap() : [Attachment 397917] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 28 19:54:11 PDT 2020


Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 211160: REGRESSION (r260407): Over-release of NSGraphicsContext in
WebKit::convertPlatformImageToBitmap()
https://bugs.webkit.org/show_bug.cgi?id=211160

Attachment 397917: Patch v1

https://bugs.webkit.org/attachment.cgi?id=397917&action=review




--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 397917
  --> https://bugs.webkit.org/attachment.cgi?id=397917
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=397917&action=review

>>> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:408
>>> +	 RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext
currentContext];
>> 
>> Do we have an RAII object to save NSGraphicsContext.currentContext?	Seems
like it might be useful.
> 
> Looks like we have this in WebCore, but it's all CG-based:
> 
>     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
>     CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext
currentContext] graphicsPort];
>     ALLOW_DEPRECATED_DECLARATIONS_END
> 
>     CGContextStateSaver stateSaver(cgContext);
> 
> Via drawCellFocusRingWithFrameAtTime() in
Source/WebCore/platform/mac/ThemeMac.mm.

Instead of writing out RetainPtr, I suggest you just change the adoptNS() to
retainPtr().


More information about the webkit-reviews mailing list