From b847d8cf36522383832248ef0c9d2648be6508d6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 5 Jul 2022 12:06:49 +0200 Subject: [PATCH 1/2] Fix ConcurrentModificationException on BackgroundDetectionObserver --- .../android/sdk/internal/util/BackgroundDetectionObserver.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/BackgroundDetectionObserver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/BackgroundDetectionObserver.kt index 2dd16d8375..901d0eca8f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/BackgroundDetectionObserver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/BackgroundDetectionObserver.kt @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.util import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.LifecycleOwner import timber.log.Timber +import java.util.concurrent.CopyOnWriteArraySet internal interface BackgroundDetectionObserver : DefaultLifecycleObserver { val isInBackground: Boolean @@ -37,7 +38,7 @@ internal class DefaultBackgroundDetectionObserver : BackgroundDetectionObserver override var isInBackground: Boolean = true private set - private val listeners = LinkedHashSet() + private val listeners = CopyOnWriteArraySet() override fun register(listener: BackgroundDetectionObserver.Listener) { listeners.add(listener) From b68e01cda48201c8eda48489b8c61d0b7f1607b7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 5 Jul 2022 12:11:50 +0200 Subject: [PATCH 2/2] Changelog --- changelog.d/6469.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6469.bugfix diff --git a/changelog.d/6469.bugfix b/changelog.d/6469.bugfix new file mode 100644 index 0000000000..5a9cb4022e --- /dev/null +++ b/changelog.d/6469.bugfix @@ -0,0 +1 @@ +Fix ConcurrentModificationException on BackgroundDetectionObserver