mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 12:34:30 +00:00
loader/lottie: fix a memory leak
A dangling scene instance should be deleted properly.
This commit is contained in:
parent
d683d2e70d
commit
87dee3c1f7
3 changed files with 6 additions and 2 deletions
Binary file not shown.
|
@ -607,7 +607,7 @@ static void _updateRoundedCorner(LottieRoundedCorner* roundedCorner, int32_t fra
|
||||||
|
|
||||||
static void _updateRepeater(LottieRepeater* repeater, int32_t frameNo, RenderContext& ctx)
|
static void _updateRepeater(LottieRepeater* repeater, int32_t frameNo, RenderContext& ctx)
|
||||||
{
|
{
|
||||||
ctx.repeater.cnt = repeater->copies(frameNo);
|
ctx.repeater.cnt = static_cast<int>(repeater->copies(frameNo));
|
||||||
ctx.repeater.offset = repeater->offset(frameNo);
|
ctx.repeater.offset = repeater->offset(frameNo);
|
||||||
ctx.repeater.position = repeater->position(frameNo);
|
ctx.repeater.position = repeater->position(frameNo);
|
||||||
ctx.repeater.anchor = repeater->anchor(frameNo);
|
ctx.repeater.anchor = repeater->anchor(frameNo);
|
||||||
|
@ -788,8 +788,12 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo)
|
||||||
|
|
||||||
//FIXME: Ignore opacity when Null layer?
|
//FIXME: Ignore opacity when Null layer?
|
||||||
if (layer->type != LottieLayer::Null) {
|
if (layer->type != LottieLayer::Null) {
|
||||||
|
if (layer->cache.opacity == 0 && !layer->matteSrc) {
|
||||||
|
delete(layer->scene);
|
||||||
|
layer->scene = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
layer->scene->opacity(layer->cache.opacity);
|
layer->scene->opacity(layer->cache.opacity);
|
||||||
if (layer->cache.opacity == 0) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layer->scene->transform(layer->cache.matrix);
|
layer->scene->transform(layer->cache.matrix);
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue