diff --git a/src/loaders/lottie/tvgLottieProperty.h b/src/loaders/lottie/tvgLottieProperty.h index 7178277a..66fe2ab2 100644 --- a/src/loaders/lottie/tvgLottieProperty.h +++ b/src/loaders/lottie/tvgLottieProperty.h @@ -215,8 +215,14 @@ struct LottieGenericProperty : LottieProperty T value; LottieGenericProperty(T v) : value(v) {} + LottieGenericProperty() {} ~LottieGenericProperty() + { + release(); + } + + void release() { delete(frames); } @@ -271,11 +277,17 @@ struct LottiePathSet : LottieProperty PathSet value; ~LottiePathSet() + { + release(); + } + + void release() { free(value.cmds); free(value.pts); if (!frames) return; + for (auto p = frames->begin(); p < frames->end(); ++p) { free((*p).value.cmds); free((*p).value.pts); @@ -461,10 +473,11 @@ struct LottieColorStop : LottieProperty const_cast(other).frames = nullptr; } else { value = other.value; - const_cast(other).value.data = nullptr; + const_cast(other).value = {nullptr, nullptr}; } populated = other.populated; count = other.count; + return *this; } @@ -482,6 +495,11 @@ struct LottiePosition : LottieProperty } ~LottiePosition() + { + release(); + } + + void release() { delete(frames); } @@ -616,4 +634,4 @@ using LottieFloat = LottieGenericProperty; using LottieOpacity = LottieGenericProperty; using LottieColor = LottieGenericProperty; -#endif //_TVG_LOTTIE_PROPERTY_H_ \ No newline at end of file +#endif //_TVG_LOTTIE_PROPERTY_H_