Skip to content

Commit

Permalink
Fix originalNode memory leak
Browse files Browse the repository at this point in the history
Reviewed By: mdvacca

Differential Revision: D7608359

fbshipit-source-id: 7cf69f987d4c92202ea5794b76345cb1c685f881
  • Loading branch information
ayc1 authored and facebook-github-bot committed Apr 16, 2018
1 parent 8621d4b commit 8102e35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void manageChildren(
}
enqueueUpdateProperties(newNode);
manageChildren(prevNode, prevNode.getChildrenList(), newNode.getChildrenList());
prevNode.setOriginalReactShadowNode(newNode);
newNode.setOriginalReactShadowNode(null);
}
int firstRemovedOrAddedViewIndex = sameReactTagIndex;

Expand All @@ -78,7 +78,7 @@ private void manageChildren(
viewsToAdd.add(new ViewAtIndex(newNode.getReactTag(), k));
List previousChildrenList = newNode.getOriginalReactShadowNode() == null ? null : newNode.getOriginalReactShadowNode().getChildrenList();
manageChildren(newNode, previousChildrenList, newNode.getChildrenList());
newNode.setOriginalReactShadowNode(newNode);
newNode.setOriginalReactShadowNode(null);
addedTags.add(newNode.getReactTag());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableNativeMap;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.modules.i18nmanager.I18nUtil;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
Expand Down Expand Up @@ -95,7 +96,8 @@ public ReactShadowNode createNode(
}
}

private ReactShadowNode getRootNode(int rootTag) {
@VisibleForTesting
ReactShadowNode getRootNode(int rootTag) {
return mRootShadowNodeRegistry.getNode(rootTag);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import android.util.Log;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
import com.facebook.yoga.YogaNodeCloneFunction;
import com.facebook.yoga.YogaAlign;
import com.facebook.yoga.YogaBaselineFunction;
import com.facebook.yoga.YogaConfig;
Expand All @@ -23,6 +22,7 @@
import com.facebook.yoga.YogaJustify;
import com.facebook.yoga.YogaMeasureFunction;
import com.facebook.yoga.YogaNode;
import com.facebook.yoga.YogaNodeCloneFunction;
import com.facebook.yoga.YogaOverflow;
import com.facebook.yoga.YogaPositionType;
import com.facebook.yoga.YogaValue;
Expand Down

0 comments on commit 8102e35

Please sign in to comment.