Potential fix for, and more diagnostics for, NativeAnimatedModule crash

Summary:
Searching for details and maybe a fix for T68843308 crashing in disconnectFromView, "Attempting to disconnect view that has not been connected with the given animated node".

May be related to recent refactoring but it's not clear. Change logic slightly and add more diagnostic information.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22153179

fbshipit-source-id: b95dbaf01ae8bca154c61442898b0f9d3aebb4de
This commit is contained in:
Joshua Gross
2020-06-20 17:47:29 -07:00
committed by Facebook GitHub Bot
parent 9760a326c9
commit e661a551cb
@@ -45,17 +45,20 @@ import java.util.Map;
public void connectToView(int viewTag, UIManager uiManager) {
if (mConnectedViewTag != -1) {
throw new JSApplicationIllegalArgumentException(
"Animated node " + mTag + " is " + "already attached to a view");
"Animated node " + mTag + " is " + "already attached to a view: " + mConnectedViewTag);
}
mConnectedViewTag = viewTag;
mUIManager = uiManager;
}
public void disconnectFromView(int viewTag) {
if (mConnectedViewTag != viewTag) {
if (mConnectedViewTag != viewTag && mConnectedViewTag != -1) {
throw new JSApplicationIllegalArgumentException(
"Attempting to disconnect view that has "
+ "not been connected with the given animated node");
+ "not been connected with the given animated node: "
+ viewTag
+ " but is connected to view "
+ mConnectedViewTag);
}
mConnectedViewTag = -1;