Skip to content

Commit

Permalink
fix: concurrent modification exception in kotlin 1.9.20 and compose 1…
Browse files Browse the repository at this point in the history
….5.10 (#245)

* fix: concurrent modification exception in kotlin 1.9.20 and compose 1.5.10

* copying collection

* removing unsed import
  • Loading branch information
DevSrSouza authored Nov 5, 2023
1 parent d6b7e5e commit 68381cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public object ScreenModelStore : ScreenDisposable {


private fun Map<String, *>.onEachHolder(holderKey: String, block: (String) -> Unit) =
asSequence()
toMap() // copy
.filter { it.key.startsWith(holderKey) }
.map { it.key }
.forEach(block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public actual class ThreadSafeMap<K, V>(
}

override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
get() = delegate.entries
get() = synchronized(syncObject) { delegate.entries.toMutableSet() }
override val keys: MutableSet<K>
get() = delegate.keys
get() = synchronized(syncObject) { delegate.keys.toMutableSet() }
override val values: MutableCollection<V>
get() = delegate.values
get() = synchronized(syncObject) { delegate.values.toMutableList() }

override fun clear() {
synchronized(syncObject) { delegate.clear() }
Expand Down

0 comments on commit 68381cc

Please sign in to comment.