Skip to content

Commit

Permalink
Resolve T94204073 by swallowing errors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Jul 8, 2021
1 parent fb386fc commit 94a2b2c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
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);
Expand Down Expand Up @@ -90,7 +92,13 @@ public static ScrollEvent obtain(

@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() {}
Expand Down

0 comments on commit 94a2b2c

Please sign in to comment.