Title: [284827] branches/safari-612-branch/Source/WebCore
Revision
284827
Author
[email protected]
Date
2021-10-25 14:50:46 -0700 (Mon, 25 Oct 2021)

Log 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 <[email protected]> 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

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (284826 => 284827)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-25 21:50:43 UTC (rev 284826)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-25 21:50:46 UTC (rev 284827)
@@ -1,5 +1,44 @@
 2021-10-25  Null  <[email protected]>
 
+        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 <[email protected]> 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
+
+    2021-09-29  Kimmo Kinnunen  <[email protected]>
+
+            Cocoa GraphicsContextGLOpenGL should be more robust in destruction
+            https://bugs.webkit.org/show_bug.cgi?id=230940
+
+            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):
+
+2021-10-25  Null  <[email protected]>
+
         Cherry-pick r283515. rdar://problem/84624826
 
     [WebAuthn] Prefer internal user verification if available over pin entry.

Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (284826 => 284827)


--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-10-25 21:50:43 UTC (rev 284826)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-10-25 21:50:46 UTC (rev 284827)
@@ -427,19 +427,18 @@
 {
     GraphicsContextGLOpenGLManager::sharedManager().removeContext(this);
     if (makeContextCurrent()) {
-        GraphicsContextGLAttributes attrs = contextAttributes();
-        gl::DeleteTextures(1, &m_texture);
-
-        if (attrs.antialias) {
+        if (m_texture)
+            gl::DeleteTextures(1, &m_texture);
+        if (m_multisampleColorBuffer)
             gl::DeleteRenderbuffers(1, &m_multisampleColorBuffer);
-            if (attrs.stencil || attrs.depth)
-                gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+        if (m_multisampleDepthStencilBuffer)
+            gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+        if (m_multisampleFBO)
             gl::DeleteFramebuffers(1, &m_multisampleFBO);
-        } else {
-            if (attrs.stencil || attrs.depth)
-                gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
-        }
-        gl::DeleteFramebuffers(1, &m_fbo);
+        if (m_depthStencilBuffer)
+            gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
+        if (m_fbo)
+            gl::DeleteFramebuffers(1, &m_fbo);
         if (m_preserveDrawingBufferTexture)
             gl::DeleteTextures(1, &m_preserveDrawingBufferTexture);
         if (m_preserveDrawingBufferFBO)
@@ -451,8 +450,9 @@
         for (auto& fence : m_frameCompletionFences)
             fence.abandon();
     }
-    if (m_displayBufferPbuffer) {
+    if (m_displayBufferPbuffer)
         EGL_DestroySurface(m_displayObj, m_displayBufferPbuffer);
+    if (m_swapChain) {
         auto recycledBuffer = m_swapChain->recycleBuffer();
         if (recycledBuffer.handle)
             EGL_DestroySurface(m_displayObj, recycledBuffer.handle);
@@ -463,8 +463,8 @@
     if (m_contextObj) {
         clearCurrentContext();
         EGL_DestroyContext(m_displayObj, m_contextObj);
-    } else
-        ASSERT(currentContext != this);
+    }
+    ASSERT(currentContext != this);
     LOG(WebGL, "Destroyed a GraphicsContextGLOpenGL (%p).", this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to