From 99501b741c1164fa12581cd06f0e7ab3fbce8792 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Fri, 23 Mar 2018 11:26:11 -0400 Subject: 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 Reviewed-by: Robert Phillips --- tests/SurfaceTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/SurfaceTest.cpp') 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, -- cgit v1.2.3