⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284827 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 2:50:46 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r283299. rdar://problem/84629227

Cocoa GraphicsContextGLOpenGL should be more robust in destruction
https://bugs.webkit.org/show_bug.cgi?id=230940

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-09-29
Reviewed by Antti Koivisto.

Delete resources based on checking if they exist, not based on
a flag that should cause them to exist. Currently the constructor can return early,
so various resources might not exist even if their flag condition would
indicate they should.

No new tests, refactor.

  • platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/WebCore/ChangeLog

    r284824 r284827  
     12021-10-25  Null  <null@apple.com>
     2
     3        Cherry-pick r283299. rdar://problem/84629227
     4
     5    Cocoa GraphicsContextGLOpenGL should be more robust in destruction
     6    https://bugs.webkit.org/show_bug.cgi?id=230940
     7   
     8    Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-09-29
     9    Reviewed by Antti Koivisto.
     10   
     11    Delete resources based on checking if they exist, not based on
     12    a flag that should cause them to exist. Currently the constructor can return early,
     13    so various resources might not exist even if their flag condition would
     14    indicate they should.
     15   
     16    No new tests, refactor.
     17   
     18    * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
     19    (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
     20   
     21    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     22
     23    2021-09-29  Kimmo Kinnunen  <kkinnunen@apple.com>
     24
     25            Cocoa GraphicsContextGLOpenGL should be more robust in destruction
     26            https://bugs.webkit.org/show_bug.cgi?id=230940
     27
     28            Reviewed by Antti Koivisto.
     29
     30            Delete resources based on checking if they exist, not based on
     31            a flag that should cause them to exist. Currently the constructor can return early,
     32            so various resources might not exist even if their flag condition would
     33            indicate they should.
     34
     35            No new tests, refactor.
     36
     37            * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
     38            (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
     39
    1402021-10-25  Null  <null@apple.com>
    241
  • branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm

    r284393 r284827  
    428428    GraphicsContextGLOpenGLManager::sharedManager().removeContext(this);
    429429    if (makeContextCurrent()) {
    430         GraphicsContextGLAttributes attrs = contextAttributes();
    431         gl::DeleteTextures(1, &m_texture);
    432 
    433         if (attrs.antialias) {
     430        if (m_texture)
     431            gl::DeleteTextures(1, &m_texture);
     432        if (m_multisampleColorBuffer)
    434433            gl::DeleteRenderbuffers(1, &m_multisampleColorBuffer);
    435             if (attrs.stencil || attrs.depth)
    436                 gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     434        if (m_multisampleDepthStencilBuffer)
     435            gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     436        if (m_multisampleFBO)
    437437            gl::DeleteFramebuffers(1, &m_multisampleFBO);
    438         } else {
    439             if (attrs.stencil || attrs.depth)
    440                 gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
    441         }
    442         gl::DeleteFramebuffers(1, &m_fbo);
     438        if (m_depthStencilBuffer)
     439            gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
     440        if (m_fbo)
     441            gl::DeleteFramebuffers(1, &m_fbo);
    443442        if (m_preserveDrawingBufferTexture)
    444443            gl::DeleteTextures(1, &m_preserveDrawingBufferTexture);
     
    452451            fence.abandon();
    453452    }
    454     if (m_displayBufferPbuffer) {
     453    if (m_displayBufferPbuffer)
    455454        EGL_DestroySurface(m_displayObj, m_displayBufferPbuffer);
     455    if (m_swapChain) {
    456456        auto recycledBuffer = m_swapChain->recycleBuffer();
    457457        if (recycledBuffer.handle)
     
    464464        clearCurrentContext();
    465465        EGL_DestroyContext(m_displayObj, m_contextObj);
    466     } else
    467         ASSERT(currentContext != this);
     466    }
     467    ASSERT(currentContext != this);
    468468    LOG(WebGL, "Destroyed a GraphicsContextGLOpenGL (%p).", this);
    469469}
Note: See TracChangeset for help on using the changeset viewer.