From c8e934007a48465e584cdeed9ef02077d3cd5451 Mon Sep 17 00:00:00 2001 From: senorblanco Date: Tue, 21 Apr 2015 07:20:36 -0700 Subject: [PATCH] Yet more ASAN fixes. More nullptr checks for factories I have added. Other checks more Yoda-like I have made. (Skia style this is.) BUG=skia: Review URL: https://codereview.chromium.org/1086393004 --- tests/ImageFilterTest.cpp | 12 ++++++++++++ tests/SurfaceTest.cpp | 2 +- tests/TessellatingPathRendererTests.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 1fe9228fe4..6c596156fe 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -1141,6 +1141,9 @@ const SkSurfaceProps gProps = SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_Ini DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { GrContext* context = factory->get(static_cast(0)); + if (NULL == context) { + return; + } SkAutoTUnref device(SkGpuDevice::Create(context, SkSurface::kNo_Budgeted, SkImageInfo::MakeN32Premul(100, 100), @@ -1151,6 +1154,9 @@ DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) { GrContext* context = factory->get(static_cast(0)); + if (NULL == context) { + return; + } SkAutoTUnref device(SkGpuDevice::Create(context, SkSurface::kNo_Budgeted, SkImageInfo::MakeN32Premul(100, 100), @@ -1161,6 +1167,9 @@ DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) { DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { GrContext* context = factory->get(static_cast(0)); + if (NULL == context) { + return; + } SkAutoTUnref device(SkGpuDevice::Create(context, SkSurface::kNo_Budgeted, SkImageInfo::MakeN32Premul(1, 1), @@ -1171,6 +1180,9 @@ DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { GrContext* context = factory->get(static_cast(0)); + if (NULL == context) { + return; + } SkAutoTUnref device(SkGpuDevice::Create(context, SkSurface::kNo_Budgeted, SkImageInfo::MakeN32Premul(1, 1), diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index dbf5fb9ce3..a7c6460508 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -251,7 +251,7 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto GrContext* ctx = NULL; #if SK_SUPPORT_GPU ctx = factory->get(GrContextFactory::kNative_GLContextType); - if (!ctx) { + if (NULL == ctx) { return; } #endif diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index c59d4951fe..712a20fe10 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -242,7 +242,7 @@ static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, const SkPath& path) DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) { GrContext* context = factory->get(static_cast(0)); - if (!context) { + if (NULL == context) { return; } GrSurfaceDesc desc;