Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc |
index eea4e8cb1c7f91d04d225de5b66a120edf2738b7..ee25a045d89c983c3e2654c070ab45b51f25e3c6 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc |
@@ -223,10 +223,19 @@ void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { |
&vertex_array_id_map_, have_context, |
[](GLuint vertex_array) { glDeleteVertexArraysOES(1, &vertex_array); }); |
+ // Destroy the surface before the context, some surface destructors make GL |
+ // calls. |
+ surface_ = nullptr; |
+ |
if (group_) { |
group_->Destroy(this, have_context); |
group_ = nullptr; |
} |
+ |
+ if (context_.get()) { |
+ context_->ReleaseCurrent(nullptr); |
+ context_ = nullptr; |
+ } |
} |
void GLES2DecoderPassthroughImpl::SetSurface( |