From 4ef508d3a723956011314b5059dd27a8cde73eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Mon, 20 Apr 2020 11:41:26 +0800 Subject: [PATCH] align userinfo access in js thread --- doric-iOS/Pod/Classes/Engine/DoricJSEngine.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m index 7d6f6e8d..efc2f92a 100644 --- a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m +++ b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m @@ -223,11 +223,12 @@ - (void)destroyContext:(NSString *)contextId { } - (void)callbackTimer:(NSTimer *)timer { - NSDictionary *userInfo = timer.userInfo; - NSNumber *timerId = [userInfo valueForKey:@"timerId"]; - NSNumber *repeat = [userInfo valueForKey:@"repeat"]; __weak typeof(self) _self = self; dispatch_async(self.jsQueue, ^() { + NSDictionary *userInfo = timer.userInfo; + NSNumber *timerId = [userInfo valueForKey:@"timerId"]; + NSNumber *repeat = [userInfo valueForKey:@"repeat"]; + __strong typeof(_self) self = _self; @try { [self invokeDoricMethod:DORIC_TIMER_CALLBACK, timerId, nil];