Title: [283299] trunk/Source/WebCore
- Revision
- 283299
- Author
- [email protected]
- Date
- 2021-09-29 22:17:38 -0700 (Wed, 29 Sep 2021)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (283298 => 283299)
--- trunk/Source/WebCore/ChangeLog 2021-09-30 05:00:57 UTC (rev 283298)
+++ trunk/Source/WebCore/ChangeLog 2021-09-30 05:17:38 UTC (rev 283299)
@@ -1,3 +1,20 @@
+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-09-29 Simon Fraser <[email protected]>
Minor cleanup of some rubber-banding code in ScrollingEffectsController
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (283298 => 283299)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-09-30 05:00:57 UTC (rev 283298)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-09-30 05:17:38 UTC (rev 283299)
@@ -429,19 +429,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)
@@ -453,8 +452,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);
@@ -465,8 +465,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