mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-11 23:21:55 +00:00
loader lottie: fixed the memory leaks.
All memory leaks detected by the sanitizer have been fixed.
This commit is contained in:
parent
3e8225a5ba
commit
229efd7807
2 changed files with 7 additions and 4 deletions
|
@ -232,6 +232,9 @@ static void _updateChildren(LottieGroup* parent, int32_t frameNo, Shape* baseSha
|
||||||
{
|
{
|
||||||
if (parent->children.empty()) return;
|
if (parent->children.empty()) return;
|
||||||
|
|
||||||
|
//inherits the parent's shape properties.
|
||||||
|
baseShape = baseShape ? static_cast<Shape*>(baseShape->duplicate()) : Shape::gen().release();
|
||||||
|
|
||||||
//merge shapes if they are continuously appended?
|
//merge shapes if they are continuously appended?
|
||||||
Shape* mergingShape = nullptr;
|
Shape* mergingShape = nullptr;
|
||||||
|
|
||||||
|
@ -239,7 +242,7 @@ static void _updateChildren(LottieGroup* parent, int32_t frameNo, Shape* baseSha
|
||||||
for (auto child = parent->children.end() - 1; child >= parent->children.data; --child) {
|
for (auto child = parent->children.end() - 1; child >= parent->children.data; --child) {
|
||||||
switch ((*child)->type) {
|
switch ((*child)->type) {
|
||||||
case LottieObject::Group: {
|
case LottieObject::Group: {
|
||||||
mergingShape = _updateGroup(parent, static_cast<LottieGroup*>(*child), frameNo, static_cast<Shape*>(baseShape->duplicate()), reset);
|
mergingShape = _updateGroup(parent, static_cast<LottieGroup*>(*child), frameNo, baseShape, reset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LottieObject::Transform: {
|
case LottieObject::Transform: {
|
||||||
|
@ -288,6 +291,7 @@ static void _updateChildren(LottieGroup* parent, int32_t frameNo, Shape* baseSha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete(baseShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _updatePrecomp(LottieLayer* precomp, int32_t frameNo, bool reset)
|
static void _updatePrecomp(LottieLayer* precomp, int32_t frameNo, bool reset)
|
||||||
|
@ -340,8 +344,7 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
auto baseShape = Shape::gen();
|
_updateChildren(layer, frameNo, nullptr, reset);
|
||||||
_updateChildren(layer, frameNo, baseShape.get(), reset);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct RGB24
|
||||||
|
|
||||||
struct ColorStop
|
struct ColorStop
|
||||||
{
|
{
|
||||||
Fill::ColorStop* data;
|
Fill::ColorStop* data = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue