aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SurfaceTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-03-23 11:26:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-23 15:57:10 +0000
commit99501b741c1164fa12581cd06f0e7ab3fbce8792 (patch)
tree91a2c81172c89a6e5d996ad02de877861d979336 /tests/SurfaceTest.cpp
parent48ce22b374c987e91584efb3665e7a835fdd14da (diff)
Fix leak of backend texture in GrContext_maxSurfaceSamplesForColorType test
Bug: skia:7729 Change-Id: I0e946f15e16a7f4e42d862ac468323f29d65357a Reviewed-on: https://skia-review.googlesource.com/116182 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/SurfaceTest.cpp')
-rw-r--r--tests/SurfaceTest.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index bd3090cc8e..e74dcc915c 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -191,7 +191,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, repo
auto* gpu = ctxInfo.grContext()->contextPriv().getGpu();
GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
nullptr, kSize, kSize, colorType, true, GrMipMapped::kNo);
-
+ if (!backendTex.isValid()) {
+ continue;
+ }
+ SkScopeExit freeTex([&backendTex, gpu] {gpu->deleteTestingOnlyBackendTexture(backendTex);});
auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr);
auto surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex,
kTopLeft_GrSurfaceOrigin, max,