<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - PlatformDisplay crash when calling egl_terminate"
   href="https://bugs.webkit.org/show_bug.cgi?id=157973#c7">Comment # 7</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - PlatformDisplay crash when calling egl_terminate"
   href="https://bugs.webkit.org/show_bug.cgi?id=157973">bug 157973</a>
              from <span class="vcard"><a class="email" href="mailto:zan&#64;falconsigh.net" title="Zan Dobersek &lt;zan&#64;falconsigh.net&gt;"> <span class="fn">Zan Dobersek</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=280228&amp;action=diff" name="attach_280228" title="Patch">attachment 280228</a> <a href="attachment.cgi?id=280228&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=280228&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=280228&amp;action=review</a>

<span class="quote">&gt;&gt; Source/WebCore/platform/graphics/PlatformDisplay.cpp:171
&gt;&gt; +    std::atexit([] { PlatformDisplay::sharedDisplay().terminateEGLDisplay(); });
&gt; 
&gt; This is harmless, but not really great, since it means terminateEGLDisplay will be redundantly called on the sharedDisplay once for each time initializeEGLDisplay is called on ANY PlatformDisplay object. Perhaps it would it make sense to check if this == PlatformDisplay::sharedDisplay before registering the atexit handler here. Alternatively, and probably better, move this to inside the lambda in PlatformDisplay::sharedDisplay, where it will be called at most once. Or, perhaps the best option is to call terminateEGLDisplay on the current PlatformDisplay (i.e. |this| rather than the sharedDisplay) and remove the call to terminateEGLDisplay from the destructor.</span >

Only PlatformDisplay::sharedDisplay() should ever live during the program lifetime, so this method would only be called only once as well. Asserting !m_eglDisplayInitialized at the beginning here would be helpful in that regard.</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>