Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: src/core/SkSpecialSurface.cpp

Issue 1666373002: Fix memory leak in SkSpecialSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpecialSurface.cpp
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 5d57dcfd4fc0bea5c1677e43955ef74c7b769de5..548552cc93a7aecbe0f8fc8a6644bdb9dc284fc5 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698