Blankj / Blankj/AndroidUtilCode

多线程环境下获取当前栈顶ActivityUtils.getTopActivity() crash

Open
#1,725 0 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

## Describe the bug

A clear and concise description of what the bug is.

- The version of AndroidUtilCode: utilcode:1.30.6

- The version of device: API 31

## The code of bug
getTopActivity()
```
多线程环境下获取当前栈顶ActivityUtils.getTopActivity()
## The stack of crash

# pool-29-thread-1(5773)

java.util.ConcurrentModificationException
解析原始
java.util.LinkedList$LinkIterator.next(LinkedList.java:124)
java.util.LinkedList.addAll(LinkedList.java:394)
java.util.LinkedList.(LinkedList.java:261)
com.blankj.utilcode.util.UtilsActivityLifecycleImpl.java.util.List getActivityList()(UtilsActivityLifecycleImpl.java:69)
com.blankj.utilcode.util.UtilsActivityLifecycleImpl.android.app.Activity getTopActivity()(UtilsActivityLifecycleImpl.java:57)
com.blankj.utilcode.util.UtilsBridge.android.app.Activity getTopActivity()(UtilsBridge.java)
com.blankj.utilcode.util.ActivityUtils.android.app.Activity getTopActivity()(ActivityUtils.java)

## Screenshots

If applicable, add screenshots to help explain your problem.

## Please delete the current line and the following.

Thank you for supporting [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode).

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.