Skip to content

Commit 32fee85

Browse files
committed
fix(android): snapshot listeners before iterating to avoid ConcurrentModificationException
onChanged runs on Dispatchers.Default; addListener/removeListener run on the JS thread. A concurrent mutation during iteration throws CME. The ensureValueListenerJob double-create concern in the review is not real since all calls come from the single-threaded JS side.
1 parent 416374d commit 32fee85

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BaseHybridViewModelPropertyImpl<T> : BaseHybridViewModelProperty<T> {
3535
}
3636

3737
override fun onChanged(value: T) {
38-
listeners.values.forEach { listener ->
38+
listeners.values.toList().forEach { listener ->
3939
listener(value)
4040
}
4141
}

0 commit comments

Comments
 (0)