aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-02-23 11:32:32 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 17:43:08 +0000
commit8e15cdf778401e919ddcd3b553b64ddeffd85fa1 (patch)
tree6f3d2fc1fe09220fda60911111241c5f3cb5e629 /src
parent372953bac3fd4b48925b32b995b97e614e2f4bed (diff)
Fix memory leak: adopt rather than ref GrTexture* in GrTextureStripAtlas
This was introduced in: https://skia-review.googlesource.com/c/8881/ (Switch GrTextureStripAtlas over to GrTextureProxies) Change-Id: I6635e9fee9f63d703373b31c31fda459f5b63763 Reviewed-on: https://skia-review.googlesource.com/8916 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 2de70762cb..6bc7ec0480 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -207,24 +207,24 @@ void GrTextureStripAtlas::lockTexture() {
builder.finish();
// MDB TODO (caching): this side-steps the issue of proxies with unique IDs
- GrTexture* texture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key);
+ sk_sp<GrTexture> texture(fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key));
if (!texture) {
- texture = fDesc.fContext->textureProvider()->createTexture(texDesc, SkBudgeted::kYes,
- nullptr, 0);
+ texture.reset(fDesc.fContext->textureProvider()->createTexture(texDesc, SkBudgeted::kYes,
+ nullptr, 0));
if (!texture) {
return;
}
// We will be issuing writes to the surface using kDontFlush_PixelOpsFlag, so we
// need to make sure any existing IO is flushed
- fDesc.fContext->flushSurfaceIO(texture);
- fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, texture);
+ fDesc.fContext->flushSurfaceIO(texture.get());
+ fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, texture.get());
// This is a new texture, so all of our cache info is now invalid
this->initLRU();
fKeyTable.rewind();
}
SkASSERT(texture);
- fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(sk_ref_sp(texture));
+ fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(texture));
}
void GrTextureStripAtlas::unlockTexture() {