From 080792345087980b7bb887073ba2a0dfc9890e5b Mon Sep 17 00:00:00 2001 From: wwwcg Date: Thu, 21 Dec 2023 21:47:55 +0800 Subject: [PATCH] fix(ios): fix HippyDisplayLink leak --- framework/ios/base/HippyDisplayLink.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/ios/base/HippyDisplayLink.m b/framework/ios/base/HippyDisplayLink.m index c4be3f76b8e..991d18a2e69 100644 --- a/framework/ios/base/HippyDisplayLink.m +++ b/framework/ios/base/HippyDisplayLink.m @@ -23,12 +23,13 @@ #import "HippyDisplayLink.h" #import -#import +#import #import "HippyAssert.h" #import "HippyBridgeModule.h" #import "HippyFrameUpdate.h" #import "HippyModuleData.h" +#import "HippyWeakProxy.h" #define HippyAssertRunLoop() HippyAssert(_runLoop == [NSRunLoop currentRunLoop], @"This method must be called on the CADisplayLink run loop") @@ -41,7 +42,8 @@ @implementation HippyDisplayLink { - (instancetype)init { if ((self = [super init])) { _frameUpdateObservers = [NSMutableSet new]; - _jsDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_jsThreadUpdate:)]; + HippyWeakProxy *weakProxy = [HippyWeakProxy weakProxyForObject:self]; + _jsDisplayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(_jsThreadUpdate:)]; } return self;