Index: gpu/command_buffer/client/gles2_implementation.cc |
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc |
index e19911c81705b831b8e470ad5a0eb025afb46a0d..cdaad8262ae3487b9ea24842f84c554f58eca738 100644 |
--- a/gpu/command_buffer/client/gles2_implementation.cc |
+++ b/gpu/command_buffer/client/gles2_implementation.cc |
@@ -204,8 +204,8 @@ GLES2Implementation::~GLES2Implementation() { |
// If it's destroyed it will use this GLES2Implemenation. |
share_group_->SetGLES2ImplementationForDestruction(this); |
share_group_ = NULL; |
- // Make sure the commands make it the service. |
- Finish(); |
+ // Finally, finish commands and free shared memory buffers. |
+ FreeEverything(); |
} |
GLES2CmdHelper* GLES2Implementation::helper() const { |
@@ -250,7 +250,8 @@ void GLES2Implementation::FreeUnusedSharedMemory() { |
void GLES2Implementation::FreeEverything() { |
Finish(); |
- query_tracker_->Shrink(); |
+ if (query_tracker_.get()) |
+ query_tracker_->Shrink(); |
FreeUnusedSharedMemory(); |
transfer_buffer_->Free(); |
helper_->FreeRingBuffer(); |