Blankj / Blankj/AndroidUtilCode

NetworkUtils for 循环同步操作问题

Open
#1,395 4 comments 0 reactions 1 assignee Claimed by @Blankj View on GitHub
bug
Dominant language
Java
Stars
33.6k
Forks
10.6k
PR merge metrics
No merged PRs in 30d

Description

## 描述 Bug

NetworkUtils 支持注册多个网络变化监听器
但是在内部的回调中,使用for 循环分发给外部注册的监听器
此时有概率产生ConcurrentModificationException

- AndroidUtilCode 的版本:utilcode:1.29.0
- 出现 Bug 的设备型号:理论为全部
- 设备的 Android 版本:理论为全部

## 相关代码

![image](https://user-images.githubusercontent.com/17329105/102032718-88b7e600-3df4-11eb-96f0-dd79e2ed2052.png)

看了下最新版1.30.5 对应NetworkUtils 896 行也是这样的

## 异常堆栈
如截图

## 截图

如果有的话请添加屏幕截图以帮助解释问题。
![image](https://user-images.githubusercontent.com/17329105/102032783-ac7b2c00-3df4-11eb-9ae7-562be144074f.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.