Skip to content

Commit

Permalink
fix(ios): fix weak ref issue in closure
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifanyuan authored and hippy-actions[bot] committed Nov 30, 2023
1 parent acce0e6 commit 182ce4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions renderer/native/ios/renderer/HippyUIManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@ - (void)setFrame:(CGRect)frame forView:(UIView *)view{
}
__weak id weakSelf = self;
std::vector<std::function<void()>> ops_ = {[hippyTag, rootTag, weakSelf, frame]() {
if (!weakSelf) {
HippyUIManager *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
HippyUIManager *strongSelf = weakSelf;
HippyShadowView *renderObject = [strongSelf->_shadowViewRegistry componentForTag:hippyTag onRootTag:rootTag];
if (renderObject == nil) {
return;
Expand All @@ -444,10 +444,10 @@ - (void)setFrame:(CGRect)frame forRootView:(UIView *)view {
}
__weak id weakSelf = self;
std::vector<std::function<void()>> ops_ = {[componentTag, weakSelf, frame]() {
if (!weakSelf) {
HippyUIManager *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
HippyUIManager *strongSelf = weakSelf;
HippyShadowView *renderObject = [strongSelf->_shadowViewRegistry rootComponentForTag:componentTag];
if (renderObject == nil) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ - (void)setLayoutFrame:(CGRect)frame dirtyPropagation:(BOOL)dirtyPropagation {
__weak HippyShadowView *weakSelf = self;
std::vector<std::function<void()>> ops = {[weakSelf, domManager, frame, dirtyPropagation](){
@autoreleasepool {
if (!weakSelf) {
HippyShadowView *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
HippyShadowView *strongSelf = weakSelf;
int32_t componentTag = [[strongSelf hippyTag] intValue];
auto node = domManager->GetNode(strongSelf.rootNode, componentTag);
auto renderManager = domManager->GetRenderManager().lock();
Expand Down

0 comments on commit 182ce4e

Please sign in to comment.