Don't pass on receiveEvent after CatalystInstance destruction

Summary:
It is possible for receiveEvent to be called concurrently with/after destruction of FabricUIManager. Drop events if we are able to detect that case.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D29596271

fbshipit-source-id: 1fa50d9c3cff0bf578316d905966e1bdfffe94d1
This commit is contained in:
Joshua Gross
2021-07-08 11:36:50 -07:00
committed by Facebook GitHub Bot
parent 771d584098
commit 8ed4068381
@@ -820,6 +820,11 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
FLog.d(TAG, "Emitted event without surfaceId: [%d] %s", reactTag, eventName);
}
if (mDestroyed) {
FLog.e(TAG, "Attempted to receiveEvent after destruction");
return;
}
EventEmitterWrapper eventEmitter = mMountingManager.getEventEmitter(surfaceId, reactTag);
if (eventEmitter == null) {