Commit 9c8b9003 authored by Antoine Labour's avatar Antoine Labour Committed by Commit Bot

Destroy GLES2DecoderImpl before its DecoderClient

In places where we use CommandBufferDirect, it needs to outlive the
GLES2DecoderImpl, as it's the DecoderClient.

Bug: None
Change-Id: I05669a49ca870cadecb37f28498187ded35e8236
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1639357
Auto-Submit: Antoine Labour <piman@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665286}
parent e3d45125
...@@ -134,10 +134,11 @@ void DirectContextProvider::Destroy() { ...@@ -134,10 +134,11 @@ void DirectContextProvider::Destroy() {
gl_context_.reset(); gl_context_.reset();
transfer_buffer_.reset(); transfer_buffer_.reset();
gles2_cmd_helper_.reset(); gles2_cmd_helper_.reset();
command_buffer_.reset();
decoder_->Destroy(have_context); decoder_->Destroy(have_context);
decoder_.reset(); decoder_.reset();
command_buffer_.reset();
} }
void DirectContextProvider::SetGLRendererCopierRequiredState( void DirectContextProvider::SetGLRendererCopierRequiredState(
......
...@@ -231,9 +231,9 @@ class RecordReplayContext : public GpuControl { ...@@ -231,9 +231,9 @@ class RecordReplayContext : public GpuControl {
gles2_implementation_.reset(); gles2_implementation_.reset();
transfer_buffer_.reset(); transfer_buffer_.reset();
gles2_helper_.reset(); gles2_helper_.reset();
command_buffer_.reset();
decoder_->Destroy(true); decoder_->Destroy(true);
decoder_.reset(); decoder_.reset();
command_buffer_.reset();
} }
void StartRecord() { void StartRecord() {
......
...@@ -469,13 +469,13 @@ void GLManager::Destroy() { ...@@ -469,13 +469,13 @@ void GLManager::Destroy() {
} }
transfer_buffer_.reset(); transfer_buffer_.reset();
gles2_helper_.reset(); gles2_helper_.reset();
command_buffer_.reset();
if (decoder_.get()) { if (decoder_.get()) {
bool have_context = decoder_->GetGLContext() && bool have_context = decoder_->GetGLContext() &&
decoder_->GetGLContext()->MakeCurrent(surface_.get()); decoder_->GetGLContext()->MakeCurrent(surface_.get());
decoder_->Destroy(have_context); decoder_->Destroy(have_context);
decoder_.reset(); decoder_.reset();
} }
command_buffer_.reset();
context_ = nullptr; context_ = nullptr;
} }
......
...@@ -355,10 +355,10 @@ void Context::DestroyService() { ...@@ -355,10 +355,10 @@ void Context::DestroyService() {
transfer_buffer_.reset(); transfer_buffer_.reset();
gles2_cmd_helper_.reset(); gles2_cmd_helper_.reset();
command_buffer_.reset();
if (decoder_) if (decoder_)
decoder_->Destroy(have_context); decoder_->Destroy(have_context);
decoder_.reset(); decoder_.reset();
command_buffer_.reset();
} }
bool Context::HasService() const { bool Context::HasService() const {
......
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