stylo: Don't leak nsStyleCoord::Calc objects when setting gradients.

This commit is contained in:
Cameron McCormack 2017-02-18 17:59:30 +08:00
parent 47ebeaa95c
commit 5531e38c22
2 changed files with 11 additions and 2 deletions

View file

@ -297,10 +297,10 @@ impl nsStyleImage {
},
};
let mut coord: nsStyleCoord = nsStyleCoord::null();
for (index, stop) in gradient.stops.iter().enumerate() {
// NB: stops are guaranteed to be none in the gecko side by
// default.
let mut coord: nsStyleCoord = nsStyleCoord::null();
coord.set(stop.position);
let color = match stop.color {
CSSColor::CurrentColor => {
@ -322,7 +322,7 @@ impl nsStyleImage {
stop.mColor = color;
stop.mIsInterpolationHint = false;
stop.mLocation.copy_from(&coord);
stop.mLocation.move_from(coord);
}
unsafe {