<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Memory leak for a protected element having pending events in ImageLoader"
   href="https://bugs.webkit.org/show_bug.cgi?id=146538#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Memory leak for a protected element having pending events in ImageLoader"
   href="https://bugs.webkit.org/show_bug.cgi?id=146538">bug 146538</a>
              from <span class="vcard"><a class="email" href="mailto:beidson&#64;apple.com" title="Brady Eidson &lt;beidson&#64;apple.com&gt;"> <span class="fn">Brady Eidson</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=146538#c3">comment #3</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=146538#c2">comment #2</a>)
&gt; &gt; Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=255984&amp;action=diff" name="attach_255984" title="Use RefPtr not calling ref/deref() directly">attachment 255984</a> <a href="attachment.cgi?id=255984&amp;action=edit" title="Use RefPtr not calling ref/deref() directly">[details]</a></span>
&gt; &gt; Use RefPtr not calling ref/deref() directly
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; <a href="https://bugs.webkit.org/attachment.cgi?id=255984&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=255984&amp;action=review</a>
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/loader/ImageLoader.cpp:363
&gt; &gt; &gt; +            m_protectedElement= &amp;element();
&gt; &gt; 
&gt; &gt; Type: Missing a space before the =.
&gt; &gt; 
&gt; &gt; (Really bummed that check-webkit-style didn't get this)
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/loader/ImageLoader.cpp:372
&gt; &gt; &gt; +    m_protectedElement.clear();
&gt; &gt; 
&gt; &gt; This should be:
&gt; &gt; m_protectedElement = nullptr;
&gt; 
&gt; 
&gt; m_protectedElement is RefPtr.
&gt; clear() will clear the internal pointer to nullptr.</span >

I know.

Assigning a nullptr to a RefPtr is functionally the same as calling clear() on it.

But when somebody not familiar with the code is reading it, and they come across a call to &quot;.clear()&quot;, they don't necessarily know you're null'ing out a RefPtr. They might think you're calling &quot;clear()&quot; on some object that has a whole bunch of behavior inside of its ::clear() method.

But by assigning nullptr, it's obvious to anybody reading the code &quot;This is a pointer - it might be a raw pointer or one of our various types of smart pointers, but I know it's a pointer and this code is null'ing it out&quot;

This request is about readability by people not familiar with the code.</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>