Skip to content

Commit b224687

Browse files
committed
Revert "fix(android): use ConcurrentHashMap for listeners to prevent CME"
This reverts commit 54c28c1.
1 parent 33fa8ca commit b224687

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

android/src/main/java/com/margelo/nitro/rive/BaseHybridViewModelPropertyImpl.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ import kotlinx.coroutines.flow.Flow
1212
import kotlinx.coroutines.flow.drop
1313
import java.lang.ref.WeakReference
1414
import java.util.UUID
15-
import java.util.concurrent.ConcurrentHashMap
1615

1716
@Keep
1817
@DoNotStrip
1918
class BaseHybridViewModelPropertyImpl<T> : BaseHybridViewModelProperty<T> {
2019
override var scope: CoroutineScope? = null
2120
override var job: Job? = null
22-
override val listeners = ConcurrentHashMap<String, (T) -> Unit>()
21+
override val listeners = mutableMapOf<String, (T) -> Unit>()
2322

2423
override fun ensureValueListenerJob(valueFlow: Flow<T>, drop: Int) {
2524
if (scope == null) {
@@ -35,7 +34,7 @@ class BaseHybridViewModelPropertyImpl<T> : BaseHybridViewModelProperty<T> {
3534
}
3635

3736
override fun onChanged(value: T) {
38-
listeners.values.forEach { listener ->
37+
listeners.values.toList().forEach { listener ->
3938
listener(value)
4039
}
4140
}

0 commit comments

Comments
 (0)