mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 17:21:11 +08:00
Unbreak master build.
Summary:public
== cause ==
The follow block is error-prone.
```
for (ReactInstanceEventListener listener : mReactInstanceEventListeners) {
listener.onReactContextInitialized(reactContext);
}
```
Because calling `listener.onReactContextInitialized` may have side-effect that
removes the `listener` from `mReactInstanceEventListeners`, thus break the
iteration with exception.
I've found at least one place that has such side-effect
diffusion/FA/browse/master/java/com/facebook/fbreact/autoupdater/AutoUpdaterScheduler.java;9c09e5bbd411e093fb2ad022ee5d0ea473e9ebfe$32
The right way to fix this is to be side-effect proof.
Reviewed By: zahanm
Differential Revision: D2943494
fb-gh-sync-id: ba848ea736c5d2d0b8ef0b5a899603d734781361
shipit-source-id: ba848ea736c5d2d0b8ef0b5a899603d734781361
This commit is contained in:
committed by
facebook-github-bot-4
parent
d8e07eab95
commit
011dc8904f
@@ -663,7 +663,11 @@ import static com.facebook.react.bridge.ReactMarkerConstants.*;
|
||||
attachMeasuredRootViewToInstance(rootView, catalystInstance);
|
||||
}
|
||||
|
||||
for (ReactInstanceEventListener listener : mReactInstanceEventListeners) {
|
||||
ReactInstanceEventListener[] listeners =
|
||||
new ReactInstanceEventListener[mReactInstanceEventListeners.size()];
|
||||
listeners = mReactInstanceEventListeners.toArray(listeners);
|
||||
|
||||
for (ReactInstanceEventListener listener : listeners) {
|
||||
listener.onReactContextInitialized(reactContext);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user