<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Clean up DataObjectGtk handling"
href="https://bugs.webkit.org/show_bug.cgi?id=162267#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Clean up DataObjectGtk handling"
href="https://bugs.webkit.org/show_bug.cgi?id=162267">bug 162267</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=162267#c3">comment #3</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=289342&action=diff" name="attach_289342" title="Patch">attachment 289342</a> <a href="attachment.cgi?id=289342&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=289342&action=review">https://bugs.webkit.org/attachment.cgi?id=289342&action=review</a>
>
> > 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?</span >
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>