mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-28 22:18:46 +03:00
fixing concurrent dispatch crash by using copy on write set
- whilst closing the session, we iterate through all the listeners calling onSessionStopped however some implementations also use this callback to remove themselves from the listeners, causing the concurrent modification crash
This commit is contained in:
parent
a8cd6ca497
commit
23cd6dae42
2 changed files with 3 additions and 1 deletions
1
changelog.d/5821.bugfix
Normal file
1
changelog.d/5821.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fixes concurrent modification crash when signing out or launching the app
|
|
@ -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.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import java.util.concurrent.CopyOnWriteArraySet
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@SessionScope
|
@SessionScope
|
||||||
internal class SessionListeners @Inject constructor() {
|
internal class SessionListeners @Inject constructor() {
|
||||||
|
|
||||||
private val listeners = mutableSetOf<Session.Listener>()
|
private val listeners = CopyOnWriteArraySet<Session.Listener>()
|
||||||
|
|
||||||
fun addListener(listener: Session.Listener) {
|
fun addListener(listener: Session.Listener) {
|
||||||
synchronized(listeners) {
|
synchronized(listeners) {
|
||||||
|
|
Loading…
Reference in a new issue