Cleanup unref and null

BUG=skia:
R=mtklein@google.com, scroggo@google.com, iancottrell@chromium.org

Author: iancottrell@google.com

Review URL: https://codereview.chromium.org/163053005

git-svn-id: http://skia.googlecode.com/svn/trunk@13457 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-02-14 17:27:10 +00:00
parent 54318d3430
commit 550db50db3

View File

@ -164,12 +164,7 @@ void SkPicture::clone(SkPicture* pictures, int count) const {
clone->fWidth = fWidth;
clone->fHeight = fHeight;
clone->fRecord = NULL;
if (NULL != clone->fRecord) {
clone->fRecord->unref();
clone->fRecord = NULL;
}
SkSafeSetNull(clone->fRecord);
SkDELETE(clone->fPlayback);
/* We want to copy the src's playback. However, if that hasn't been built
@ -196,10 +191,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
fPlayback = NULL;
}
if (NULL != fRecord) {
fRecord->unref();
fRecord = NULL;
}
SkSafeSetNull(fRecord);
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
@ -246,8 +238,7 @@ void SkPicture::endRecording() {
if (NULL != fRecord) {
fRecord->endRecording();
fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
fRecord->unref();
fRecord = NULL;
SkSafeSetNull(fRecord);
}
}
SkASSERT(NULL == fRecord);