OSDN Git Service

Fix SkShader leak for Gradient VectorDrawable and test
authorDoris Liu <tianliu@google.com>
Mon, 10 Oct 2016 22:50:01 +0000 (15:50 -0700)
committerDoris Liu <tianliu@google.com>
Wed, 12 Oct 2016 01:22:11 +0000 (01:22 +0000)
commitfc9cf72339c7ce61adb11ceb3b247f112577fb6b
tree3ba78d43724d731fe47fbda1c0b2fbd3db27129e
parent6c816c6707a5539a7a951617a8b621887c36eb38
Fix SkShader leak for Gradient VectorDrawable and test

This CL fixes a SkShader leak in VD when applying local matrix
to the shader. Specifically, the usage of newWithLocalMatrix(...)
increments the shader's ref count in every draw() call for
Gradient VectorDrawable, whereas there's no balancing call to
decrement the ref count in draw(). In this CL, we assume
the ownership of the shader returned from newWithLocalMatrix(...)
to ensure the correct ref count management.

Also, add test to verify that shader is no longer being leaked

BUG: 32067647
Test: this CL

Change-Id: Ic15fe46cde06a73d81b44e2d3c56b51907344cc0
libs/hwui/VectorDrawable.cpp
libs/hwui/tests/unit/VectorDrawableTests.cpp