Access to mListenerList is not synchronized and it is accessed from at least two different threads: ParseThread handler thread and thread where register/remove listener methods called (usually main thread).
This sometimes causes crashes:
Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at com.facebook.network.connectionclass.ConnectionClassManager.notifyListeners(ConnectionClassManager.java:1205)
at com.facebook.network.connectionclass.DeviceBandwidthSampler$SamplingHandler.addSample(DeviceBandwidthSampler.java:121)
at com.facebook.network.connectionclass.DeviceBandwidthSampler$SamplingHandler.handleMessage(DeviceBandwidthSampler.java:100)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
ConnectionClassManager sometimes throws
IndexOutOfBoundException
here: https://github.com/facebook/network-connection-class/blob/master/connectionclass/src/main/java/com/facebook/network/connectionclass/ConnectionClassManager.java#L245Access to
mListenerList
is not synchronized and it is accessed from at least two different threads:ParseThread
handler thread and thread where register/remove listener methods called (usually main thread).This sometimes causes crashes: