[Webkit-unassigned] [Bug 162267] [GTK] Clean up DataObjectGtk handling

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 20 23:17:40 PDT 2016


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

--- Comment #4 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to comment #3)
> Comment on attachment 289342 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289342&action=review
> 
> > Source/WebCore/platform/gtk/PasteboardHelper.cpp:295
> > +        TemporaryChange<DataObjectGtk*> change(settingClipboardDataObject, const_cast<DataObjectGtk*>(&dataObject));
> 
> Why is this function receiving a const DataObjectGtk*? Why were you unable
> to get rid of this const_cast?
> 
> > Source/WebKit2/Shared/gtk/PasteboardContent.cpp:36
> > +PasteboardContent::PasteboardContent(const WebCore::DataObjectGtk& data)
> > +    : dataObject(const_cast<WebCore::DataObjectGtk&>(data))
> 
> Again, why is the parameter const? What call site cannot be fixed?

Both are special cases. You can't create smart pointers from const references/pointers, but in these particular cases the object is going to be const, the only change we are going to do to the object is taking a reference, and RefCounted::ref() is const indeed. So we can't fix the callers, because it's correct to receive consts, but we cast to allow creating a Ref<> that we know we are ot going to modify.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160921/5a2135c0/attachment.html>


More information about the webkit-unassigned mailing list