From 06d37714f722ff9e27fa31e243428afa86bf6bd3 Mon Sep 17 00:00:00 2001 From: mtklein Date: Mon, 7 Jul 2014 07:00:14 -0700 Subject: [PATCH] Only you can prevent memory leaks. SkPaint::setFoo() refs the foo, leaving the foo with a bonus ref unless you call ->unref(). Valgrind caught this: http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind/builds/317/steps/RunTests/logs/stdio BUG=skia: R=tomhudson@chromium.org, mtklein@google.com, tomhudson@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/377523002 --- tests/RecordTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/RecordTest.cpp b/tests/RecordTest.cpp index 8ec5bcba76..2fcc1e9c53 100644 --- a/tests/RecordTest.cpp +++ b/tests/RecordTest.cpp @@ -102,7 +102,7 @@ DEF_TEST(RecordAnalysis, r) { *(bitmap2.getAddr32(0, 0)) = SK_ColorGREEN; SkShader* shader = SkShader::CreateBitmapShader(bitmap2, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); - paint2.setShader(shader); + paint2.setShader(shader)->unref(); REPORTER_ASSERT(r, shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault_BitmapType); APPEND(record, SkRecords::DrawRect, paint2, rect); -- 2.34.1