[webkit-reviews] review granted: [Bug 129437] [iOS] selectionImageForcingBlackText should return autoreleased object : [Attachment 225393] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 27 12:24:15 PST 2014


Darin Adler <darin at apple.com> has granted Pratik Solanki <psolanki at apple.com>'s
request for review:
Bug 129437: [iOS] selectionImageForcingBlackText should return autoreleased
object
https://bugs.webkit.org/show_bug.cgi?id=129437

Attachment 225393: Patch
https://bugs.webkit.org/attachment.cgi?id=225393&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=225393&action=review


>> Source/WebKit/mac/WebView/WebHTMLView.mm:6572
>> +	return
(CGImageRef)CFBridgingRelease(createDragImageForSelection(*coreFrame,
forceBlackText).leakRef());
> 
> I know C-style cast is frowned upon, but static_cast didn't work for me here.

> 
>
/Volumes/Data/psolanki/sources/Safari/OpenSource/Source/WebKit/mac/WebView/WebH
TMLView.mm:6572:12: error: cannot cast from type 'id' to pointer type
'CGImageRef' (aka 'CGImage *')
>     return
static_cast<CGImageRef>(CFBridgingRelease(createDragImageForSelection(*coreFram
e, forceBlackText).leakRef()));
>	    
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> 
> Let me know if there's something better I could do here.

I think we should prefer CFAutorelease here instead of CFBridgingRelease.
CFBridgingRelease is good when we want to turn a CF object into an autoreleased
NS object, but when we just want to do a CF autorelease, CFAutorelease seems a
better choice.

If we did that, then the static_cast would probably work, or might not be
needed at all.


More information about the webkit-reviews mailing list