Merge pull request #6362 from vector-im/bugfix/adm/dispatch-to-crash

Fixing concurrent `dispatchTo` crash
This commit is contained in:
Adam Brown 2022-06-22 14:00:20 +01:00 committed by GitHub
commit 9925cf9996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
changelog.d/5821.bugfix Normal file
View File

@ -0,0 +1 @@
Fixes concurrent modification crash when signing out or launching the app

View File

@ -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<Session.Listener>()
private val listeners = CopyOnWriteArraySet<Session.Listener>()
fun addListener(listener: Session.Listener) {
synchronized(listeners) {