From c40b9fe47f8779719eb414eed9f30456546a00f9 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 7 May 2024 13:58:21 +0900 Subject: [PATCH] lottie/expressions: fixed a memory access violation. Reset memory after freeing the singletone instance. --- src/loaders/lottie/tvgLottieExpressions.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/loaders/lottie/tvgLottieExpressions.cpp b/src/loaders/lottie/tvgLottieExpressions.cpp index fa6c6faa..df671be3 100644 --- a/src/loaders/lottie/tvgLottieExpressions.cpp +++ b/src/loaders/lottie/tvgLottieExpressions.cpp @@ -52,6 +52,8 @@ static const char* EXP_VALUE = "value"; static const char* EXP_INDEX = "index"; static const char* EXP_EFFECT= "effect"; +static LottieExpressions* exps = nullptr; //singleton instance engine + static void contentFree(void *native_p, struct jerry_object_native_info_t *info_p) { @@ -1267,8 +1269,6 @@ void LottieExpressions::update(float curTime) LottieExpressions* LottieExpressions::instance() { - static LottieExpressions* exps = nullptr; - //FIXME: Threads support if (TaskScheduler::threads() > 1) { TVGLOG("LOTTIE", "Lottie Expressions are not supported with tvg threads"); @@ -1283,7 +1283,10 @@ LottieExpressions* LottieExpressions::instance() void LottieExpressions::retrieve(LottieExpressions* instance) { - if (--engineRefCnt == 0) delete(instance); + if (--engineRefCnt == 0) { + delete(instance); + exps = nullptr; + } }