Chromium Code Reviews| Index: src/core/SkPicturePlayback.cpp |
| diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp |
| index 898d37957811392393f4f7e756422e991ab5cc32..e96fc902aaa9cd9012bd66add739dbdbc5901bdb 100644 |
| --- a/src/core/SkPicturePlayback.cpp |
| +++ b/src/core/SkPicturePlayback.cpp |
| @@ -520,15 +520,24 @@ void SkPicturePlayback::parseStreamTag(SkStream* stream, const SkPictInfo& info, |
| case PICT_PICTURE_TAG: { |
| fPictureCount = size; |
| fPictureRefs = SkNEW_ARRAY(SkPicture*, fPictureCount); |
| - bool success; |
| for (int i = 0; i < fPictureCount; i++) { |
| - fPictureRefs[i] = SkNEW_ARGS(SkPicture, (stream, &success, proc)); |
| - // Success can only be false if PICTURE_VERSION does not match |
| + fPictureRefs[i] = SkPicture::CreateFromStream(stream, proc); |
| + // CreateFromStream can only fail if PICTURE_VERSION does not match |
| // (which should never happen from here, since a sub picture will |
| // have the same PICTURE_VERSION as its parent) or if stream->read |
| // returns 0. In the latter case, we have a bug when writing the |
| // picture to begin with, which will be alerted to here. |
| - SkASSERT(success); |
| + SkASSERT(fPictureRefs[i] != NULL); |
| + if (NULL == fPictureRefs[i]) { |
|
reed1
2013/06/24 22:24:14
so we want this, or is it better to crash? Do we c
scroggo
2013/06/25 15:36:50
We do not check for read failures in other places.
|
| + // Delete the already created picture refs. |
| + for (int k = 0; k < i; k++) { |
| + fPictureRefs[i]->unref(); |
| + } |
| + // Delete the array |
| + SkDELETE_ARRAY(fPictureRefs); |
| + fPictureCount = 0; |
| + return; |
| + } |
| } |
| } break; |
| case PICT_BUFFER_SIZE_TAG: { |