Skip to content

Commit

Permalink
RCTDisplayLink.m > Use autoreleasepool from CFRunLoopPerformBlock
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[iOS][Fixed] This is a quick speculative fix since we know `CFRunLoopPerformBlock` does not push/pop an autorelease pool.

Reviewed By: appden

Differential Revision: D32657298

fbshipit-source-id: 4641ad89baf7889ba4bf80e6e64e26de02818cb8
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Nov 25, 2021
1 parent b8f0e97 commit 3fff164
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions React/Base/RCTDisplayLink.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ - (void)registerModuleForFrameUpdates:(id<RCTBridgeModule>)module withModuleData
[weakSelf updateJSDisplayLinkState];
} else {
CFRunLoopPerformBlock(cfRunLoop, kCFRunLoopDefaultMode, ^{
[weakSelf updateJSDisplayLinkState];
@autoreleasepool {
[weakSelf updateJSDisplayLinkState];
}
});
CFRunLoopWakeUp(cfRunLoop);
}
Expand All @@ -73,7 +75,9 @@ - (void)registerModuleForFrameUpdates:(id<RCTBridgeModule>)module withModuleData
// start receiving updates anyway.
if (![observer isPaused] && _runLoop) {
CFRunLoopPerformBlock([_runLoop getCFRunLoop], kCFRunLoopDefaultMode, ^{
[self updateJSDisplayLinkState];
@autoreleasepool {
[self updateJSDisplayLinkState];
}
});
}
}
Expand Down

0 comments on commit 3fff164

Please sign in to comment.