diff --git a/src/loaders/lottie/tvgLottieModel.h b/src/loaders/lottie/tvgLottieModel.h index 4ed89220..feb32e78 100644 --- a/src/loaders/lottie/tvgLottieModel.h +++ b/src/loaders/lottie/tvgLottieModel.h @@ -84,7 +84,7 @@ struct LottieStroke struct LottieMask { - LottiePathSet pathset = PathSet{nullptr, nullptr, 0, 0}; + LottiePathSet pathset; LottieOpacity opacity = 255; CompositeMethod method; bool inverse = false; @@ -245,7 +245,7 @@ struct LottiePath : LottieShape if (pathset.frames) statical = false; } - LottiePathSet pathset = PathSet{nullptr, nullptr, 0, 0}; + LottiePathSet pathset; }; diff --git a/src/loaders/lottie/tvgLottieProperty.h b/src/loaders/lottie/tvgLottieProperty.h index 49b69840..8e6f8b2d 100644 --- a/src/loaders/lottie/tvgLottieProperty.h +++ b/src/loaders/lottie/tvgLottieProperty.h @@ -31,10 +31,10 @@ struct PathSet { - Point* pts; - PathCommand* cmds; - uint16_t ptsCnt; - uint16_t cmdsCnt; + Point* pts = nullptr; + PathCommand* cmds = nullptr; + uint16_t ptsCnt = 0; + uint16_t cmdsCnt = 0; }; @@ -253,8 +253,8 @@ struct LottieGenericProperty : LottieProperty { //shallow copy, used for slot overriding delete(frames); - frames = other.frames; - value = other.value; + if (other.frames) frames = other.frames; + else value = other.value; const_cast(other).frames = nullptr; return *this; } @@ -269,10 +269,6 @@ struct LottiePathSet : LottieProperty Array>* frames = nullptr; PathSet value; - LottiePathSet(PathSet v) : value(v) - { - } - ~LottiePathSet() { free(value.cmds); @@ -447,8 +443,8 @@ struct LottieColorStop : LottieProperty { //shallow copy, used for slot overriding delete(frames); - frames = other.frames; - value = other.value; + if (other.frames) frames = other.frames; + else value = other.value; count = other.count; const_cast(other).frames = nullptr; return *this; @@ -569,8 +565,8 @@ struct LottieTextDoc : LottieProperty { //shallow copy, used for slot overriding delete(frames); - frames = other.frames; - value = other.value; + if (other.frames) frames = other.frames; + else value = other.value; const_cast(other).frames = nullptr; return *this; }