diff --git a/changelog.d/5821.bugfix b/changelog.d/5821.bugfix new file mode 100644 index 0000000000..25d8fd2b46 --- /dev/null +++ b/changelog.d/5821.bugfix @@ -0,0 +1 @@ +Fixes concurrent modification crash when signing out or launching the app diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionListeners.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionListeners.kt index 756b9cef83..0dae24e64b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionListeners.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionListeners.kt @@ -19,12 +19,13 @@ package org.matrix.android.sdk.internal.session import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.session.Session import timber.log.Timber +import java.util.concurrent.CopyOnWriteArraySet import javax.inject.Inject @SessionScope internal class SessionListeners @Inject constructor() { - private val listeners = mutableSetOf() + private val listeners = CopyOnWriteArraySet() fun addListener(listener: Session.Listener) { synchronized(listeners) {