fix a colorstatelist's memleak

This commit is contained in:
houzh 2023-11-28 15:19:41 +08:00
parent e1e4c520ee
commit bd37128832
2 changed files with 4 additions and 4 deletions

View File

@ -109,9 +109,8 @@ void Drawable::setColorFilter(int color,PorterDuffMode mode) {
}
void Drawable::setTint(int color) {
ColorStateList*tint =ColorStateList::valueOf(color);
setTintList(tint);
delete tint;
ColorStateList cls(color);
setTintList(&cls);
}
PorterDuffColorFilter *Drawable::updateTintFilter(PorterDuffColorFilter* tintFilter,const ColorStateList* tint,int tintMode) {

View File

@ -340,7 +340,8 @@ void GradientDrawable::setStroke(int width, const ColorStateList*colorStateList)
}
void GradientDrawable::setStroke(int width,int color, float dashWidth, float dashGap) {
mGradientState->setStroke(width, ColorStateList::valueOf(color), dashWidth, dashGap);
ColorStateList cls(color);
mGradientState->setStroke(width, &cls, dashWidth, dashGap);
setStrokeInternal(width, color, dashWidth, dashGap);
}