diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-06 13:43:22 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-06 13:43:22 +0000 |
commit | 6b43cd455a50dabb07fcadf19853ad8c2552d90f (patch) | |
tree | 015df3c26cde2d9b65afb6a12b851f82ee801574 | |
parent | a864a8193e91f008c32825dd35fe9bece425699b (diff) | |
download | src-6b43cd455a50dabb07fcadf19853ad8c2552d90f.tar.gz |
Fix memory leak in GPU Picture optimization
R=jvanverth@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/265763008
git-svn-id: http://skia.googlecode.com/svn/trunk/src@14589 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gpu/GrPictureUtils.h | 6 | ||||
-rw-r--r-- | gpu/SkGpuDevice.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gpu/GrPictureUtils.h b/gpu/GrPictureUtils.h index 8fdb3b85..c6252986 100644 --- a/gpu/GrPictureUtils.h +++ b/gpu/GrPictureUtils.h @@ -45,6 +45,12 @@ public: GPUAccelData(Key key) : INHERITED(key) { } + virtual ~GPUAccelData() { + for (int i = 0; i < fSaveLayerInfo.count(); ++i) { + SkDELETE(fSaveLayerInfo[i].fPaint); + } + } + void addSaveLayerInfo(const SaveLayerInfo& info) { SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID); *fSaveLayerInfo.push() = info; diff --git a/gpu/SkGpuDevice.cpp b/gpu/SkGpuDevice.cpp index 3119a9e7..517f082a 100644 --- a/gpu/SkGpuDevice.cpp +++ b/gpu/SkGpuDevice.cpp @@ -1913,7 +1913,7 @@ SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) { SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); - GPUAccelData* data = SkNEW_ARGS(GPUAccelData, (key)); + SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key))); picture->EXPERIMENTAL_addAccelData(data); |