From 9ab61190308306700f89c070b598bf2ce8ddf8aa Mon Sep 17 00:00:00 2001 From: wwwcg Date: Thu, 27 Jun 2024 14:47:43 +0800 Subject: [PATCH] fix(ios): resolve a multithreading issue in Animator --- ios/sdk/module/animation2/pop/HPOPAnimator.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/sdk/module/animation2/pop/HPOPAnimator.mm b/ios/sdk/module/animation2/pop/HPOPAnimator.mm index 21a3df3a650..21981085074 100644 --- a/ios/sdk/module/animation2/pop/HPOPAnimator.mm +++ b/ios/sdk/module/animation2/pop/HPOPAnimator.mm @@ -532,11 +532,14 @@ - (void)_scheduleProcessPendingList pthread_mutex_unlock(&_lock); } -- (void)_renderTime:(CFTimeInterval)time items:(std::list)items +- (void)_renderTime:(CFTimeInterval)time items:(std::list &)items { // begin transaction with actions disabled [CATransaction begin]; [CATransaction setDisableActions:YES]; + + // lock + pthread_mutex_lock(&_lock); // notify delegate NSArray *allDelegates = _animatorDelegates.allObjects; @@ -544,9 +547,6 @@ - (void)_renderTime:(CFTimeInterval)time items:(std::list)it [delegate animatorWillAnimate:self]; } - // lock - pthread_mutex_lock(&_lock); - // count active animations const NSUInteger count = items.size(); if (0 == count) {