mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix racecondition in registration of event listeners
Summary: This diff fixes a racecondition in registration of event listeners. mPostEventDispatchListeners is accessed from different threads, most of the times this variable is used to executed the listeners. It is only written during initialization and turn down of the renderer. changelog: [internal] Reviewed By: PeteTheHeat Differential Revision: D25667988 fbshipit-source-id: 1bf95f5193d55a737bad9403206cc3320185b8cb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a3918f4102
commit
f7c209cd54
+2
-2
@@ -20,7 +20,6 @@ import com.facebook.systrace.Systrace;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -91,7 +90,8 @@ public class EventDispatcherImpl implements EventDispatcher, LifecycleEventListe
|
||||
private final ArrayList<Event> mEventStaging = new ArrayList<>();
|
||||
private final CopyOnWriteArrayList<EventDispatcherListener> mListeners =
|
||||
new CopyOnWriteArrayList<>();
|
||||
private final List<BatchEventDispatchedListener> mPostEventDispatchListeners = new ArrayList<>();
|
||||
private final CopyOnWriteArrayList<BatchEventDispatchedListener> mPostEventDispatchListeners =
|
||||
new CopyOnWriteArrayList<>();
|
||||
private final ScheduleDispatchFrameCallback mCurrentFrameCallback =
|
||||
new ScheduleDispatchFrameCallback();
|
||||
private final AtomicInteger mHasDispatchScheduledCount = new AtomicInteger();
|
||||
|
||||
Reference in New Issue
Block a user