Skip to content

Commit f2898d4

Browse files
CalixTangmeta-codesync[bot]
authored andcommitted
VirtualViewContainerStateExperimental remove() memory leak fix (#54437)
Summary: Pull Request resolved: #54437 ## Changelog: [Internal] VirtualView ID references (strings) are currently not being removed from the bookkeeping sets V, P, HPV in VirtualViewContainerStateExperimental upon deletion. This PR provides a fix by extending the parent container's `remove()` function and correctly removing the IDs from the bookkeeping sets. Reviewed By: yungsters Differential Revision: D86369358 fbshipit-source-id: de46cc5776ff465dd3c834a6eba6a9d1c460d2d8
1 parent 6addea5 commit f2898d4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateExperimental.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ internal class VirtualViewContainerStateExperimental(scrollView: ViewGroup) :
4949
}
5050
}
5151

52+
override fun remove(virtualView: VirtualView) {
53+
super.remove(virtualView)
54+
HPV.remove(virtualView.virtualViewID)
55+
P.remove(virtualView.virtualViewID)
56+
V.remove(virtualView.virtualViewID)
57+
}
58+
5259
/**
5360
* Perform mode update check on a single VirtualView. Does not check other VirtualViews in the
5461
* collection. Use carefully

0 commit comments

Comments
 (0)