Skip to content

Commit

Permalink
avoid ConcurrentModificationException when clearing store
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielittner committed May 28, 2024
1 parent 03910e2 commit 2319502
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal class StackEntryStoreViewModel(
}

public override fun onCleared() {
for (store in stores.values) {
store.close()
while (stores.isNotEmpty()) {
val key = stores.firstNotNullOf { it.key }
stores.remove(key)?.close()
}
stores.clear()
}
}

0 comments on commit 2319502

Please sign in to comment.