<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&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <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">&gt; Comment on <span class=""><a href="attachment.cgi?id=289342&amp;action=diff" name="attach_289342" title="Patch">attachment 289342</a> <a href="attachment.cgi?id=289342&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=289342&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=289342&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/platform/gtk/PasteboardHelper.cpp:295
&gt; &gt; +        TemporaryChange&lt;DataObjectGtk*&gt; change(settingClipboardDataObject, const_cast&lt;DataObjectGtk*&gt;(&amp;dataObject));
&gt; 
&gt; Why is this function receiving a const DataObjectGtk*? Why were you unable
&gt; to get rid of this const_cast?
&gt; 
&gt; &gt; Source/WebKit2/Shared/gtk/PasteboardContent.cpp:36
&gt; &gt; +PasteboardContent::PasteboardContent(const WebCore::DataObjectGtk&amp; data)
&gt; &gt; +    : dataObject(const_cast&lt;WebCore::DataObjectGtk&amp;&gt;(data))
&gt; 
&gt; 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&lt;&gt; 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>