copying the list of new session listeners to avoid concurrent modification

- copying the list avoids the need to synchronise the add/removing/iterations
This commit is contained in:
Adam Brown 2022-04-12 17:26:15 +01:00
parent 4adb469b38
commit 594b442a21
2 changed files with 2 additions and 1 deletions

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

@ -0,0 +1 @@
Fixes crash when navigating the app whilst processing new room keys

View File

@ -74,7 +74,7 @@ internal class RoomDecryptorProvider @Inject constructor(
this.newSessionListener = object : NewSessionListener {
override fun onNewSession(roomId: String?, senderKey: String, sessionId: String) {
// PR reviewer: the parameter has been renamed so is now in conflict with the parameter of getOrCreateRoomDecryptor
newSessionListeners.forEach {
newSessionListeners.toList().forEach {
try {
it.onNewSession(roomId, senderKey, sessionId)
} catch (e: Throwable) {