Fix originalNode memory leak

Reviewed By: mdvacca

Differential Revision: D7608359

fbshipit-source-id: 7cf69f987d4c92202ea5794b76345cb1c685f881
This commit is contained in:
Andrew Chen (Eng) 2018-04-16 12:16:11 -07:00 committed by Facebook Github Bot
parent 8621d4b797
commit 8102e35271
3 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,7 @@ public class FabricReconciler {
}
enqueueUpdateProperties(newNode);
manageChildren(prevNode, prevNode.getChildrenList(), newNode.getChildrenList());
prevNode.setOriginalReactShadowNode(newNode);
newNode.setOriginalReactShadowNode(null);
}
int firstRemovedOrAddedViewIndex = sameReactTagIndex;
@ -78,7 +78,7 @@ public class FabricReconciler {
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());
}

View File

@ -18,6 +18,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
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;
@ -95,7 +96,8 @@ public class FabricUIManager implements UIManager {
}
}
private ReactShadowNode getRootNode(int rootTag) {
@VisibleForTesting
ReactShadowNode getRootNode(int rootTag) {
return mRootShadowNodeRegistry.getNode(rootTag);
}

View File

@ -11,7 +11,6 @@ import static java.lang.System.arraycopy;
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;
@ -23,6 +22,7 @@ import com.facebook.yoga.YogaFlexDirection;
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;