Commit 18afd13d authored by Antoine Labour's avatar Antoine Labour Committed by Commit Bot

gpu fuzzers: AddRef on null pointers

Translators may be null (e.g. for passthrough, or in case of failure), so only
AddRef them if they are valid.

Bug: 779954
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I8f0039eaf2bdaf76a58e74317af68c13d252bdd5
Reviewed-on: https://chromium-review.googlesource.com/746993Reviewed-by: default avatarVictor Miura <vmiura@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512894}
parent 9c6253e4
...@@ -351,8 +351,13 @@ class CommandBufferSetup { ...@@ -351,8 +351,13 @@ class CommandBufferSetup {
// Keep a reference to the translators, which keeps them in the cache even // Keep a reference to the translators, which keeps them in the cache even
// after the decoder is reset. They are expensive to initialize, but they // after the decoder is reset. They are expensive to initialize, but they
// don't keep state. // don't keep state.
decoder_->GetTranslator(GL_VERTEX_SHADER)->AddRef(); scoped_refptr<gles2::ShaderTranslatorInterface> translator =
decoder_->GetTranslator(GL_FRAGMENT_SHADER)->AddRef(); decoder_->GetTranslator(GL_VERTEX_SHADER);
if (translator)
translator->AddRef();
translator = decoder_->GetTranslator(GL_FRAGMENT_SHADER);
if (translator)
translator->AddRef();
return decoder_->MakeCurrent(); return decoder_->MakeCurrent();
} }
......
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