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
parent ed90581a1f
commit c830abb901
3 changed files with 4 additions and 3 deletions

View file

@ -299,6 +299,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

@ -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;
}