Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions React/Base/RCTDisplayLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ - (void)dealloc

- (void)invalidate
{
// [TODO: GH#858
// ensure observer callbacks do not hold a reference to weak self via pauseCallback
for (RCTModuleData *moduleData in _frameUpdateObservers) {
id<RCTFrameUpdateObserver> observer = (id<RCTFrameUpdateObserver>)moduleData.instance;
[observer setPauseCallback:nil];
}
[_frameUpdateObservers removeAllObjects]; // just to be explicit
// TODO: GH#858]

[_jsDisplayLink invalidate];
}

Expand Down Expand Up @@ -146,9 +155,7 @@ - (void)updateJSDisplayLinkState
BOOL pauseDisplayLink = YES;
for (RCTModuleData *moduleData in _frameUpdateObservers) {
id<RCTFrameUpdateObserver> observer = (id<RCTFrameUpdateObserver>)moduleData.instance;
BOOL validObserverProtocol = [observer conformsToProtocol:@protocol(RCTFrameUpdateObserver)]; // [TODO: GH#774- add protocol check before accessing data
RCTAssert(validObserverProtocol, @"Observer does not conform to necessary protocol (RCTFrameUpdateObserver)");
if (validObserverProtocol && !observer.paused) { // TODO: GH#774- add protocol check before accessing data]
if (!observer.paused) {
pauseDisplayLink = NO;
break;
}
Expand Down
1 change: 1 addition & 0 deletions React/Base/macOS/RCTPlatformDisplayLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ - (void)dealloc
if (_displayLink != NULL) {
CVDisplayLinkStop(_displayLink);
CVDisplayLinkRelease(_displayLink);
_displayLink = NULL;
}
}

Expand Down