diff options
4 files changed, 11 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 9d0efd4..f3ae4b7 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -41,8 +41,8 @@ class ContextGroup : public base::RefCounted<ContextGroup> { bool Initialize(const char* allowed_features); // Sets the ContextGroup has having a lost context. - void SetLostContext() { - have_context_ = false; + void set_have_context(bool have_context) { + have_context_ = have_context; } uint32 max_vertex_attribs() const { diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc index 006cfe3..78accf9 100644 --- a/gpu/command_buffer/service/context_group_unittest.cc +++ b/gpu/command_buffer/service/context_group_unittest.cc @@ -43,7 +43,7 @@ class ContextGroupTest : public testing::Test { virtual void TearDown() { // we must release the ContextGroup before we clear out the GL interface. // since its destructor uses GL. - group_->SetLostContext(); + group_->set_have_context(false); group_ = NULL; ::gfx::GLInterface::SetGLInterface(NULL); gl_.reset(); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 94a6e04..7f3bac22 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2342,9 +2342,9 @@ bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, } void GLES2DecoderImpl::Destroy() { - if (context_.get()) { - MakeCurrent(); - + bool have_context = context_.get() && MakeCurrent(); + group_->set_have_context(have_context); + if (have_context) { if (attrib_0_buffer_id_) { glDeleteBuffersARB(1, &attrib_0_buffer_id_); } @@ -2399,6 +2399,10 @@ void GLES2DecoderImpl::Destroy() { offscreen_saved_color_texture_.reset(); } + // must release the ContextGroup before destroying the context as its + // destructor uses GL. + group_ = NULL; + context_->Destroy(); context_.reset(); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index 79af216..de3a528 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -150,7 +150,7 @@ void GLES2DecoderTestBase::TearDown() { .RetiresOnSaturation(); decoder_->Destroy(); decoder_.reset(); - group_->SetLostContext(); + group_->set_have_context(false); group_ = NULL; engine_.reset(); ::gfx::GLInterface::SetGLInterface(NULL); |