lottie: corrected a shallow keyframe data copy bug

The previous assignment operator was missed due to a template error,
which has now been corrected.

issue: https://github.com/thorvg/thorvg/issues/2797
This commit is contained in:
Hermet Park 2024-11-01 12:26:42 +09:00 committed by Hermet Park
parent 62a4e7e6dd
commit f1cd65a876
3 changed files with 4 additions and 3 deletions

View file

@ -300,6 +300,7 @@ bool LottieLoader::override(const char* slot)
//parsing slot json
LottieParser parser(temp, dirName);
parser.comp = comp;
auto idx = 0;
while (auto sid = parser.sid(idx == 0)) {

View file

@ -1444,7 +1444,7 @@ bool LottieParser::apply(LottieSlot* slot)
case LottieProperty::Type::Color: {
obj = new LottieSolid;
context.parent = obj;
parseSlotProperty<LottieProperty::Type::Color>(static_cast<LottieSolid*>(obj)->color);
parseSlotProperty<LottieProperty::Type::Color>(static_cast<LottieSolid*>(obj)->color);
break;
}
case LottieProperty::Type::TextDoc: {

View file

@ -329,12 +329,12 @@ struct LottieGenericProperty : LottieProperty
return operator()(frameNo);
}
T& operator=(const T& other)
LottieGenericProperty<T>& operator=(const LottieGenericProperty<T>& other)
{
//shallow copy, used for slot overriding
if (other.frames) {
frames = other.frames;
const_cast<T&>(other).frames = nullptr;
const_cast<LottieGenericProperty<T>&>(other).frames = nullptr;
} else value = other.value;
return *this;
}