Index: src/core/SkPictureRecorder.cpp |
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp |
index d64390c6ef80d58e0c3c26015f8b80ad24b7c02b..69411d3bc374e78a004883abbfdc05bfdf48ca11 100644 |
--- a/src/core/SkPictureRecorder.cpp |
+++ b/src/core/SkPictureRecorder.cpp |
@@ -15,7 +15,7 @@ |
#include "SkRecordOpts.h" |
#include "SkTypes.h" |
-SkPictureRecorder::SkPictureRecorder() : fBBHFactory(NULL) {} |
+SkPictureRecorder::SkPictureRecorder() {} |
SkPictureRecorder::~SkPictureRecorder() {} |
@@ -23,7 +23,6 @@ SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect, |
SkBBHFactory* bbhFactory /* = NULL */, |
uint32_t recordFlags /* = 0 */) { |
fCullRect = cullRect; |
- fBBHFactory = bbhFactory; |
fFlags = recordFlags; |
if (bbhFactory) { |
@@ -68,7 +67,12 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() { |
if (saveLayerData) { |
pict->EXPERIMENTAL_addAccelData(saveLayerData); |
} |
- |
+ |
+ // release our refs now, so only the picture will be the owner. |
+ fRecorder.reset(NULL); |
+ fRecord.reset(NULL); |
+ fBBH.reset(NULL); |
+ |
return pict; |
} |
@@ -157,7 +161,15 @@ SkCanvasDrawable* SkPictureRecorder::EXPERIMENTAL_endRecordingAsDrawable() { |
SkRecordFillBounds(fCullRect, *fRecord, fBBH.get()); |
} |
- return SkNEW_ARGS(SkRecordedDrawable, (fRecord, fBBH, fRecorder->detachDrawableList(), |
- fCullRect, |
- SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag))); |
+ SkCanvasDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable, |
+ (fRecord, fBBH, fRecorder->detachDrawableList(), |
+ fCullRect, |
+ SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag))); |
+ |
+ // release our refs now, so only the drawable will be the owner. |
+ fRecorder.reset(NULL); |
+ fRecord.reset(NULL); |
+ fBBH.reset(NULL); |
+ |
+ return drawable; |
} |