Skip to content

Commit

Permalink
Fix stale reference to ReactViewGroup#mAllChildren (#47950)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #47950

`addInArray` may reallocate `mAllChildren` so it's not correct to store this reference.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D66474532

fbshipit-source-id: 90ce2fcbf8ff236501ed47b2acc413e54ef8b82a
  • Loading branch information
javache authored and facebook-github-bot committed Nov 26, 2024
1 parent 84adf26 commit 8869fa4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,12 @@ View getChildAtWithSubviewClippingEnabled(int index) {
/*package*/ void addViewWithSubviewClippingEnabled(
final View child, int index, ViewGroup.LayoutParams params) {
Assertions.assertCondition(mRemoveClippedSubviews);
Rect clippingRect = Assertions.assertNotNull(mClippingRect);
View[] childArray = Assertions.assertNotNull(mAllChildren);
addInArray(child, index);

// we add view as "clipped" and then run {@link #updateSubviewClipStatus} to conditionally
// attach it
Rect clippingRect = Assertions.assertNotNull(mClippingRect);
View[] childArray = Assertions.assertNotNull(mAllChildren);
int clippedSoFar = 0;
for (int i = 0; i < index; i++) {
if (isViewClipped(childArray[i])) {
Expand Down

0 comments on commit 8869fa4

Please sign in to comment.