Skip to content

Commit bb746eb

Browse files
committed
fix:修复并发移除浮窗时导致的异常
1 parent f01f289 commit bb746eb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

floatingx/src/main/java/com/petterp/floatingx/FloatingX.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ object FloatingX {
118118
@JvmStatic
119119
fun uninstallAll() {
120120
if (fxs.isEmpty()) return
121-
for (fx in fxs.values) {
122-
fx.cancel()
121+
// 这里需要避免 ConcurrentModificationException
122+
val keys = fxs.keys.toList()
123+
keys.forEach {
124+
fxs[it]?.cancel()
123125
}
124126
}
125127

0 commit comments

Comments
 (0)