Skip to content

Commit

Permalink
fix(ios): fix HippyDisplayLink leak
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and hippy-actions[bot] committed Dec 22, 2023
1 parent 051da17 commit 0807923
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions framework/ios/base/HippyDisplayLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
#import "HippyDisplayLink.h"

#import <Foundation/Foundation.h>
#import <QuartzCore/CADisplayLink.h>
#import <QuartzCore/QuartzCore.h>

#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")

Expand All @@ -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;
Expand Down

0 comments on commit 0807923

Please sign in to comment.