<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><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> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Crash of WebProcess on the last WebView disconnect"
   href="https://bugs.webkit.org/show_bug.cgi?id=161605">bug 161605</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
               &nbsp;
           </td>
           <td>cgarcia&#64;igalia.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Crash of WebProcess on the last WebView disconnect"
   href="https://bugs.webkit.org/show_bug.cgi?id=161605#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Crash of WebProcess on the last WebView disconnect"
   href="https://bugs.webkit.org/show_bug.cgi?id=161605">bug 161605</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=161605#c5">comment #5</a>)
<span class="quote">&gt; OK, so... there are a couple different ways to fix this, but fundamentally
&gt; the problem is the GLContext class hands off ownership of new GLContexts to
&gt; callers in its create functions, returning std::unique_ptrs. Then it goes
&gt; behind the callers' backs and deletes them all in an exit handler if they
&gt; haven't already been deleted. That fails here, as PlatformDisplay also gets
&gt; deleted in an exit handler, which runs after GLContext's exit handler,
&gt; causing the same GLContext to be deleted twice.</span >

This is not accurate. PlatformDisplay is not deleted in an exit handler, it's a static std::unique_ptr that is deleted after all exit handlers.

<span class="quote">&gt; There are many ways to fix this... remove the GLContext exit handler (seems
&gt; like the correct solution, but it carries a warning of possibly crashing the
&gt; X server when using nvidia proprietary driver? do we care?),</span >

Never liked that, TBH, I was tempted to remove it when reworked the GLContext. It's probably a workaround for a bug in nvidia drivers that might have already been fixed. In any case, all contexts created now except the sharing context that is owned by the PlatformDisplay should be freed already on exit.

<span class="quote">&gt; leak the
&gt; PlatformDisplay's GLContext by calling release() on the unique_ptr and rely
&gt; on the GLContext exit handler to free it,</span >

This is not possible because the GLContext exit handler is a workaround used on for X11 contexts, and other classes shouldn't rely on that.

<span class="quote">&gt; create a throwaway GLContext the
&gt; first time PlatformDisplay::initializeEGLDisplay is called to ensure the
&gt; GLContext exit handler gets registered first (and therefore executed last at
&gt; exit time)... let's see if Carlos Garcia has an opinion on what's best.</span >

This has nothing to do with EGLDisplay, the crash is happening on ~PlatformDisplay and the exit handler of the EGLDisplay doesn't delete the PlatformDisplay.

So, the solution is either removing the GLContext active contents handling assuming the nvidia issue is now fixed, or the conservative solution could be to not handle the sharing context as active context, since we are sure PlatformDisplay destructor is always called.</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>