<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GStreamer] crash within Threaded compositor"
   href="https://bugs.webkit.org/show_bug.cgi?id=159552#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GStreamer] crash within Threaded compositor"
   href="https://bugs.webkit.org/show_bug.cgi?id=159552">bug 159552</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=159552#c3">comment #3</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=283134&amp;action=diff" name="attach_283134" title="patch">attachment 283134</a> <a href="attachment.cgi?id=283134&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=283134&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=283134&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:553
&gt; &gt; -        m_player-&gt;sizeChanged();
&gt; &gt; +        RunLoop::main().dispatch([this] { m_player-&gt;sizeChanged(); });
&gt; 
&gt; Are you sure this is because of the threaded compositor and not because of
&gt; GStreamerGL. Because I think in case of not using GSTGL, triggerRepaint is
&gt; called in the main thread. In case of being in the main thread we would be
&gt; scheduling this unnecessarily. Also, if the instance is destroyed before the
&gt; source is dispatches in the main thread, this will crash, so you would need
&gt; to protect this. It would be better if we could use the main thread notifier
&gt; for this, but it's int he derived class not here in the base class.</span >

We already have a weak factory for this, so could you do something like this:

if (isMainThread())
    m_player-&gt;sizeChanged();
else {
    auto weakThis = player.createWeakPtr();
    RunLoop::main().dispatch([weakThis]) { 
        if (weakThis)
            weakThis-&gt;m_player-&gt;sizeChanged();
    });
}</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>