fix leaked picture
authorreed <reed@google.com>
Wed, 9 Sep 2015 20:42:14 +0000 (13:42 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 9 Sep 2015 20:42:14 +0000 (13:42 -0700)
BUG=skia:
TBR=

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

gm/verylargebitmap.cpp

index 112092c9fd0b2456deeb99b737dd2fc699c1c66e..5c67e77e3e99eef57c35ccf386266125e822ef2d 100644 (file)
@@ -32,7 +32,8 @@ static SkImage* make_raster_image(int width, int height, SkColor colors[2]) {
 static SkImage* make_picture_image(int width, int height, SkColor colors[2]) {
     SkPictureRecorder recorder;
     draw(recorder.beginRecording(SkRect::MakeIWH(width, height)), width, height, colors);
-    return SkImage::NewFromPicture(recorder.endRecording(), SkISize::Make(width, height),
+    SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+    return SkImage::NewFromPicture(picture, SkISize::Make(width, height),
                                    nullptr, nullptr);
 }