From 5a645538948bc9fcf85c87401430fbb8980ec599 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 7 Sep 2018 20:30:05 +0900 Subject: [PATCH] binding: fix invalid access of LOTNode data. double-pointer is not an array of pointer. there could be proper code for fixing this. Change-Id: Ia79463fa358d485b98cf2fc3cf52d080dd67a574 --- src/binding/c/lottieanimation_capi.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/binding/c/lottieanimation_capi.cpp b/src/binding/c/lottieanimation_capi.cpp index fa2f9f4..c4ac80e 100644 --- a/src/binding/c/lottieanimation_capi.cpp +++ b/src/binding/c/lottieanimation_capi.cpp @@ -8,10 +8,12 @@ extern "C" { struct Lottie_Animation_S { std::unique_ptr mAnimation; - size_t mCurFrame; - LOTNode **mNodeArray; + size_t mCurFrame{0}; + std::future mRenderTask; + size_t mFrameNo{0}; size_t mArraySize{0}; - std::future mRenderTask; + size_t mWidth{0}; + size_t mHeight{0}; }; LOT_EXPORT Lottie_Animation_S *lottie_animation_from_file(const char *file) @@ -75,9 +77,10 @@ LOT_EXPORT void lottie_animation_prepare_frame(Lottie_Animation_S *animation, si { if (!animation) return; - auto list = animation->mAnimation->renderList(frameNo, w, h); - animation->mNodeArray = list.data(); - animation->mArraySize = list.size(); + animation->mFrameNo = frameNo; + animation->mWidth = w; + animation->mHeight = h; + animation->mArraySize = animation->mAnimation->renderList(frameNo, w, h).size(); } LOT_EXPORT size_t lottie_animation_get_node_count(const Lottie_Animation_S *animation) @@ -93,7 +96,7 @@ LOT_EXPORT const LOTNode* lottie_animation_get_node(const Lottie_Animation_S *an if (idx >= animation->mArraySize) return nullptr; - return animation->mNodeArray[idx]; + return animation->mAnimation->renderList(animation->mFrameNo, animation->w, animation->h)[idx]; } LOT_EXPORT void -- 2.7.4