From ea8abe89127428078e7ee48a00089245af81c0a2 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Wed, 2 Jul 2025 14:17:35 +0200 Subject: [PATCH] lottie: prevent mem leak Masks of pooled shapes were not unrefed, filling up the memory pool. --- src/loaders/lottie/tvgLottieBuilder.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 7a3ee108..0f249b9c 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1203,7 +1203,7 @@ void LottieBuilder::updateMasks(LottieLayer* layer, float frameNo) //the first mask if (!pShape) { pShape = layer->pooling(); - pShape->reset(); + SHAPE(pShape)->reset(); auto compMethod = (method == MaskMethod::Subtract || method == MaskMethod::InvAlpha) ? MaskMethod::InvAlpha : MaskMethod::Alpha; //Cheaper. Replace the masking with a clipper if (layer->masks.count == 1 && compMethod == MaskMethod::Alpha) { @@ -1215,13 +1215,11 @@ void LottieBuilder::updateMasks(LottieLayer* layer, float frameNo) //Chain mask composition } else if (pMethod != method || pOpacity != opacity || (method != MaskMethod::Subtract && method != MaskMethod::Difference)) { auto shape = layer->pooling(); - shape->reset(); + SHAPE(shape)->reset(); pShape->mask(shape, method); pShape = shape; } - pShape->trimpath(0.0f, 1.0f); - pShape->strokeWidth(0.0f); pShape->fill(255, 255, 255, opacity); pShape->transform(layer->cache.matrix);