mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
lottie/expressions: fixed a memory access violation.
Reset memory after freeing the singletone instance.
This commit is contained in:
parent
ac295f32e2
commit
c40b9fe47f
1 changed files with 6 additions and 3 deletions
|
@ -52,6 +52,8 @@ static const char* EXP_VALUE = "value";
|
||||||
static const char* EXP_INDEX = "index";
|
static const char* EXP_INDEX = "index";
|
||||||
static const char* EXP_EFFECT= "effect";
|
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)
|
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()
|
LottieExpressions* LottieExpressions::instance()
|
||||||
{
|
{
|
||||||
static LottieExpressions* exps = nullptr;
|
|
||||||
|
|
||||||
//FIXME: Threads support
|
//FIXME: Threads support
|
||||||
if (TaskScheduler::threads() > 1) {
|
if (TaskScheduler::threads() > 1) {
|
||||||
TVGLOG("LOTTIE", "Lottie Expressions are not supported with tvg threads");
|
TVGLOG("LOTTIE", "Lottie Expressions are not supported with tvg threads");
|
||||||
|
@ -1283,7 +1283,10 @@ LottieExpressions* LottieExpressions::instance()
|
||||||
|
|
||||||
void LottieExpressions::retrieve(LottieExpressions* instance)
|
void LottieExpressions::retrieve(LottieExpressions* instance)
|
||||||
{
|
{
|
||||||
if (--engineRefCnt == 0) delete(instance);
|
if (--engineRefCnt == 0) {
|
||||||
|
delete(instance);
|
||||||
|
exps = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue