aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-02-04 14:59:58 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-04 14:59:58 -0800
commit16aad786023e4cfa338b42a5f35d4f885defb789 (patch)
treea1791674b1bfc2e8ee48a5d7e30df43e2f6e03ee
parent3a94c6c62c3c40866684b4c4772551fa95be097d (diff)
Fix memory leak in SkSpecialSurface
-rw-r--r--src/core/SkSpecialSurface.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 5d57dcfd4f..548552cc93 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -54,7 +54,7 @@ SkCanvas* SkSpecialSurface::getCanvas() {
SkSpecialImage* SkSpecialSurface::newImageSnapshot() {
SkSpecialImage* image = as_SB(this)->onNewImageSnapshot();
as_SB(this)->reset();
- return SkSafeRef(image); // the caller will call unref() to balance this
+ return image; // the caller gets the creation ref
}
///////////////////////////////////////////////////////////////////////////////
@@ -110,7 +110,7 @@ class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
public:
SkSpecialSurface_Gpu(GrTexture* texture, const SkIRect& subset, const SkSurfaceProps* props)
: INHERITED(subset, props)
- , fTexture(texture) {
+ , fTexture(SkRef(texture)) {
SkASSERT(fTexture->asRenderTarget());
@@ -151,7 +151,7 @@ SkSpecialSurface* SkSpecialSurface::NewRenderTarget(GrContext* context,
return nullptr;
}
- GrTexture* temp = context->textureProvider()->createApproxTexture(desc);
+ SkAutoTUnref<GrTexture> temp(context->textureProvider()->createApproxTexture(desc));
if (!temp) {
return nullptr;
}