From 4870e6d4c9ee76ee328969e82238c7adc371fd33 Mon Sep 17 00:00:00 2001 From: hendrikw Date: Tue, 24 Nov 2015 05:50:23 -0800 Subject: skia: Holding onto the image in the benchmark causes issues Skia'a nanobench can hold onto an image, that causes the lifetime of GrGLGpu to extend past that of the GL interface. Kill reference to surface and image before killing the interface Review URL: https://codereview.chromium.org/1472433002 --- bench/ImageBench.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bench/ImageBench.cpp') diff --git a/bench/ImageBench.cpp b/bench/ImageBench.cpp index 89fbcd6aef..b81c57c6dc 100644 --- a/bench/ImageBench.cpp +++ b/bench/ImageBench.cpp @@ -39,6 +39,13 @@ protected: fRasterSurface.reset(SkSurface::NewRaster(info)); } + void onPerCanvasPostDraw(SkCanvas*) override { + // Release the image and raster surface here to prevent out of order destruction + // between these and the gpu interface. + fRasterSurface.reset(nullptr); + fImage.reset(nullptr); + } + void onDraw(int loops, SkCanvas*) override { for (int i = 0; i < loops; i++) { for (int inner = 0; inner < 10; ++inner) { -- cgit v1.2.3