From 588b9cab10d02432faff9f433a1f61293a7f90fe Mon Sep 17 00:00:00 2001 From: robertphillips Date: Sun, 4 Oct 2015 08:40:31 -0700 Subject: [PATCH] Fix memory leak in ClipMaskManager TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/1385823002 --- src/gpu/GrClipMaskManager.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 1ddcef1..0f85517 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -308,7 +308,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder, // If MSAA is enabled we can do everything in the stencil buffer. if (0 == rt->numStencilSamples() && requiresAA) { - GrTexture* result = nullptr; + SkAutoTUnref result; // The top-left of the mask corresponds to the top-left corner of the bounds. SkVector clipToMaskOffset = { @@ -319,17 +319,17 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder, if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) { // The clip geometry is complex enough that it will be more efficient to create it // entirely in software - result = this->createSoftwareClipMask(genID, - initialState, - elements, - clipToMaskOffset, - clipSpaceIBounds); + result.reset(this->createSoftwareClipMask(genID, + initialState, + elements, + clipToMaskOffset, + clipSpaceIBounds)); } else { - result = this->createAlphaClipMask(genID, - initialState, - elements, - clipToMaskOffset, - clipSpaceIBounds); + result.reset(this->createAlphaClipMask(genID, + initialState, + elements, + clipToMaskOffset, + clipSpaceIBounds)); } if (result) { -- 2.7.4