aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-02-01 10:07:57 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-01 15:33:23 +0000
commitabba998d75bd6a36de8e971cbc26bdc9510ae405 (patch)
tree904cf51ddc5e2d01665583dd0fb7899c8b309d1a /tests
parenta71b8d17e8b0cc1ee19a75d75c1f52dc8030f68d (diff)
Fix GrBackendTextureImageGenerator to hold context lock till all proxies are gone
This fixes a bug where if we created two proxies for the same context. We would release the context lock after one of the proxies was released instead of waiting for all proxies to be released. Bug: skia: Change-Id: Ia6ed8148abb029bd1f95c85bc3d3ef003e8de408 Reviewed-on: https://skia-review.googlesource.com/102322 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageTest.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 83b1c7983d..a1472d42dd 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -891,8 +891,18 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte
ctx, GrSamplerState::ClampNearest(), nullptr, &texColorSpace, nullptr);
REPORTER_ASSERT(reporter, proxySecondRef);
- // Releae all refs from the original context
+ // Release first ref from the original context
proxy.reset(nullptr);
+
+ // We released one proxy but not the other from the current borrowing context. Make sure
+ // a new context is still not able to borrow the texture.
+ otherTestContext->makeCurrent();
+ otherProxy = as_IB(refImg)->asTextureProxyRef(otherCtx, GrSamplerState::ClampNearest(),
+ nullptr, &texColorSpace, nullptr);
+ REPORTER_ASSERT(reporter, !otherProxy);
+
+ // Release second ref from the original context
+ testContext->makeCurrent();
proxySecondRef.reset(nullptr);
// Now we should be able to borrow the texture from the other context