Resolve T94204073 by swallowing errors

Summary:
At risk of hiding errors, given the low volume, I think it's safe to cause this to crash in debug and continue gracefully in release-mode.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29618047

fbshipit-source-id: 19b19d8f6e27703227de4947ed01f7f2177f463b
This commit is contained in:
Joshua Gross
2021-07-08 12:23:57 -07:00
committed by Facebook GitHub Bot
parent fb386fccdd
commit 94a2b2c86d
@@ -11,12 +11,14 @@ import androidx.annotation.Nullable;
import androidx.core.util.Pools;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactSoftException;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.events.Event;
/** A event dispatched from a ScrollView scrolling. */
public class ScrollEvent extends Event<ScrollEvent> {
private static String TAG = ScrollEvent.class.getSimpleName();
private static final Pools.SynchronizedPool<ScrollEvent> EVENTS_POOL =
new Pools.SynchronizedPool<>(3);
@@ -90,7 +92,13 @@ public class ScrollEvent extends Event<ScrollEvent> {
@Override
public void onDispose() {
EVENTS_POOL.release(this);
try {
EVENTS_POOL.release(this);
} catch (IllegalStateException e) {
// This exception can be thrown when an event is double-released.
// This is a problem but won't cause user-visible impact, so it's okay to fail silently.
ReactSoftException.logSoftException(TAG, e);
}
}
private ScrollEvent() {}