Index: content/common/gpu/gpu_command_buffer_stub.cc |
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
index 1e89262cf69d59725c83f582b379bdcc09af2c94..d6e245dc6cb761ff8ebe326c7ac81b4024b51627 100644 |
--- a/content/common/gpu/gpu_command_buffer_stub.cc |
+++ b/content/common/gpu/gpu_command_buffer_stub.cc |
@@ -360,23 +360,16 @@ void GpuCommandBufferStub::Destroy() { |
destruction_observers_, |
OnWillDestroyStub()); |
- scoped_refptr<gfx::GLContext> context; |
if (decoder_) { |
- context = decoder_->GetGLContext(); |
+ // The surface destructor should be called with a current context. |
+ // Therefore release the stub's reference before destroying the decoder, |
+ // because the latter will release the context. |
+ surface_ = NULL; |
epenner
2013/05/28 22:57:21
Are you sure this is the last valid reference to t
no sievers
2013/05/28 23:15:32
Ah good point, I forgot to release the decoder's r
|
decoder_->Destroy(have_context); |
decoder_.reset(); |
} |
command_buffer_.reset(); |
- |
- // Make sure that context_ is current while we destroy surface_, because |
- // surface_ may have GL resources that it needs to destroy, and will need |
- // context_ to be current in order to not leak these resources. |
- if (context) |
- context->MakeCurrent(surface_.get()); |
- surface_ = NULL; |
- if (context) |
- context->ReleaseCurrent(NULL); |
} |
void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { |