loader/lottie: fix a memory leak

A dangling scene instance should be deleted properly.
This commit is contained in:
Hermet Park 2023-09-15 13:17:19 +09:00 committed by Hermet Park
parent d683d2e70d
commit 87dee3c1f7
3 changed files with 6 additions and 2 deletions

Binary file not shown.

View file

@ -607,7 +607,7 @@ static void _updateRoundedCorner(LottieRoundedCorner* roundedCorner, int32_t fra
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.position = repeater->position(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?
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);
if (layer->cache.opacity == 0) return;
}
layer->scene->transform(layer->cache.matrix);

Binary file not shown.