From d1c3b19e01a2dbcbb1bd78252123fc92c32a4dd9 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Tue, 18 Dec 2018 17:56:24 +0900 Subject: [PATCH] lottie/memoryleak: Destory the player handle properly in capi destroy() implementation. Change-Id: Ie3a2b8d619e6e7c038c4296789952ecb4653b12f --- src/binding/c/lottieanimation_capi.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/binding/c/lottieanimation_capi.cpp b/src/binding/c/lottieanimation_capi.cpp index 427135c..7de388b 100644 --- a/src/binding/c/lottieanimation_capi.cpp +++ b/src/binding/c/lottieanimation_capi.cpp @@ -36,8 +36,13 @@ LOT_EXPORT Lottie_Animation_S *lottie_animation_from_data(const char *data, cons LOT_EXPORT void lottie_animation_destroy(Lottie_Animation_S *animation) { - if (animation) + if (animation) { + if (animation->mRenderTask.valid()) { + animation->mRenderTask.get(); + } + animation->mAnimation = nullptr; delete animation; + } } LOT_EXPORT void lottie_animation_get_size(const Lottie_Animation_S *animation, size_t *width, size_t *height) -- 2.7.4