<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Soup] Clean up SocketStreamHandle soup implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159024#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Soup] Clean up SocketStreamHandle soup implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159024">bug 159024</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=159024#c3">comment #3</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=159024#c2">comment #2</a>)
&gt; &gt; Comment on <span class=""><a href="attachment.cgi?id=281842&amp;action=diff" name="attach_281842" title="Patch">attachment 281842</a> <a href="attachment.cgi?id=281842&amp;action=edit" title="Patch">[details]</a></span>
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; <a href="https://bugs.webkit.org/attachment.cgi?id=281842&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=281842&amp;action=review</a>
&gt; 
&gt; Thanks for the review!
&gt; 
&gt; &gt; &gt; Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp:223
&gt; &gt; &gt; +    g_source_set_callback(m_writeReadySource.get(), reinterpret_cast&lt;GSourceFunc&gt;(writeReadyCallback), this, [](gpointer handle) {
&gt; &gt; &gt; +        static_cast&lt;SocketStreamHandle*&gt;(handle)-&gt;deref();
&gt; &gt; &gt; +    });
&gt; &gt; 
&gt; &gt; IMO the lambda would be more readable if its header was also placed on its
&gt; &gt; own line, and all three lines being indented by 4 spaces compared to the
&gt; &gt; start of this expression.
&gt; 
&gt; I agree, I'll do that.
&gt; 
&gt; &gt; The rest of this patch adopts the leaked pointer into a RefPtr&lt;&gt; wrapper,
&gt; &gt; this should do the same.
&gt; 
&gt; Because in the other cases the callback is always called, even if the
&gt; operation is cancelled, but in this case, if the source is destroyed before
&gt; being dispatched the callback is not called and the handler leaked, that's
&gt; why I'm using the destroy notify that is always called. Also note that the
&gt; callback is called multiple times, because by default the source continues
&gt; until it's cancelled or destroyed.</span >

Sorry, I misunderstood, I thought you meant to adopt the ref in the source callback, not in the destroy notify callback. In this case I used explicit ref/deref because it's clearer than having a function that only adopts a ref and returns</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>