From cf35ca3392b17a8b1fa3d1e69d5986c6afe8eda6 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 29 Dec 2023 18:07:32 +0900 Subject: [PATCH] lottie: resolve a thread sanitizer report. Issue: https://github.com/thorvg/thorvg/issues/1874 --- src/loaders/lottie/tvgLottieLoader.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/loaders/lottie/tvgLottieLoader.cpp b/src/loaders/lottie/tvgLottieLoader.cpp index 35e17376..747c7d75 100644 --- a/src/loaders/lottie/tvgLottieLoader.cpp +++ b/src/loaders/lottie/tvgLottieLoader.cpp @@ -60,10 +60,6 @@ void LottieLoader::run(unsigned tid) comp = parser.comp; } builder->build(comp); - w = static_cast(comp->w); - h = static_cast(comp->h); - frameDuration = comp->duration(); - frameCnt = comp->frameCnt(); } } @@ -96,8 +92,15 @@ bool LottieLoader::header() //A single thread doesn't need to perform intensive tasks. if (TaskScheduler::threads() == 0) { run(0); - if (comp) return true; - else return false; + if (comp) { + w = static_cast(comp->w); + h = static_cast(comp->h); + frameDuration = comp->duration(); + frameCnt = comp->frameCnt(); + return true; + } else { + return false; + } } //Quickly validate the given Lottie file without parsing in order to get the animation info.