Commit fc8b656f authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Only Destroy if context is current

This is a speculative fix for https://crbug.com/1022151. Based on the
crash error and stack trace, it seems likely that we are calling
ClearFramebufferResourceManager::Destroy after a context is unavailable
(i.e. released or lost). In this case, we shouldn't be making any more
GL calls. This copies a pattern of GLES2DecoderImpl::Destroy, so that
CFRM::Destroy is only called if we have a current context.

Bug: 1022151
Change-Id: Icc76e505fa32c3b3bc5bea68a973ac4550828bf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934519Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718801}
parent b5b32cd5
......@@ -47,10 +47,7 @@ ClearFramebufferResourceManager::ClearFramebufferResourceManager(
Initialize(decoder);
}
ClearFramebufferResourceManager::~ClearFramebufferResourceManager() {
Destroy();
DCHECK(!buffer_id_);
}
ClearFramebufferResourceManager::~ClearFramebufferResourceManager() = default;
void ClearFramebufferResourceManager::Initialize(
const gles2::GLES2Decoder* decoder) {
......@@ -77,7 +74,6 @@ void ClearFramebufferResourceManager::Destroy() {
glDeleteProgram(program_);
glDeleteBuffersARB(1, &buffer_id_);
buffer_id_ = 0;
}
void ClearFramebufferResourceManager::ClearFramebuffer(
......
......@@ -22,6 +22,7 @@ class GPU_GLES2_EXPORT ClearFramebufferResourceManager {
ClearFramebufferResourceManager(const gles2::GLES2Decoder* decoder);
~ClearFramebufferResourceManager();
void Destroy();
void ClearFramebuffer(const gles2::GLES2Decoder* decoder,
const gfx::Size& max_viewport_size,
GLbitfield mask,
......@@ -34,7 +35,6 @@ class GPU_GLES2_EXPORT ClearFramebufferResourceManager {
private:
void Initialize(const gles2::GLES2Decoder* decoder);
void Destroy();
// The attributes used during invocation of the extension.
static const GLuint kVertexPositionAttrib = 0;
......
......@@ -5363,7 +5363,10 @@ void GLES2DecoderImpl::Destroy(bool have_context) {
srgb_converter_.reset();
}
clear_framebuffer_blit_.reset();
if (clear_framebuffer_blit_.get()) {
clear_framebuffer_blit_->Destroy();
clear_framebuffer_blit_.reset();
}
if (state_.current_program.get()) {
program_manager()->UnuseProgram(shader_manager(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment