Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 3e2414d

Browse files
committed
[ASInterfaceState] Fix for an edge case of exiting Visible state before node deallocation.
1 parent 9779801 commit 3e2414d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

AsyncDisplayKit/Details/_ASDisplayView.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
9090
self.keepalive_node = _node;
9191
}
9292
else if (currentSuperview && !newSuperview) {
93+
// Clearing keepalive_node may cause deallocation of the node. In this case, __exitHierarchy may not have an opportunity (e.g. _node will be cleared
94+
// by the time -didMoveToWindow occurs after this) to clear the Visible interfaceState, which we need to do before deallocation to meet an API guarantee.
95+
if (_node.inHierarchy) {
96+
[_node __exitHierarchy];
97+
}
9398
self.keepalive_node = nil;
9499
}
95100

0 commit comments

Comments
 (0)