From 68ba15e8239f19b8e572f6a3592a8048dfd3e36e Mon Sep 17 00:00:00 2001 From: etkmao Date: Thu, 2 Jan 2025 14:29:33 +0800 Subject: [PATCH] fix(jsc): fix ios c autorelease (#4162) --- modules/footstone/src/platform/ios/looper_driver.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/footstone/src/platform/ios/looper_driver.cc b/modules/footstone/src/platform/ios/looper_driver.cc index eac5e0d0bcb..0d0a502d18c 100644 --- a/modules/footstone/src/platform/ios/looper_driver.cc +++ b/modules/footstone/src/platform/ios/looper_driver.cc @@ -31,6 +31,9 @@ static constexpr CFTimeInterval kInterval = IOS_WORKER_TIME_INTERVAL; static constexpr CFTimeInterval kInterval = 1.0e10; #endif +extern "C" void * objc_autoreleasePoolPush(void); +extern "C" void objc_autoreleasePoolPop(void *); + static void OnTimerCb(CFRunLoopTimerRef timer, LooperDriver* driver) { FOOTSTONE_DCHECK(driver); driver->OnTimerFire(timer); @@ -88,7 +91,9 @@ void LooperDriver::OnTimerFire(CFRunLoopTimerRef timer) { if (IsExitImmediately()) { return; } + auto obj = objc_autoreleasePoolPush(); unit_(); + objc_autoreleasePoolPop(obj); } }