Skip to content
Permalink
Browse files

Ensure that all currentProviders updates run in a single thread

Fatal Exception: java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextNode(HashMap.java:1441)
       at java.util.HashMap$ValueIterator.next(HashMap.java:1470)
       at java.util.AbstractCollection.toArray(AbstractCollection.java:196)
       at kotlin.collections.CollectionsKt___CollectionsKt.sortedWith(CollectionsKt___CollectionsKt.java:2534)
       at kotlin.collections.CollectionsKt.sortedWith(CollectionsKt.java)
       at com.google.android.apps.muzei.ChooseProviderViewModel$refreshDescription$1.invokeSuspend(ChooseProviderViewModel.java:252)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
  • Loading branch information...
ianhanniballake committed Oct 9, 2019
1 parent 38a34b1 commit 1673a8fdc0f64d2e8863628930a0217c725f0b03
Showing with 1 addition and 1 deletion.
  1. +1 −1 main/src/main/java/com/google/android/apps/muzei/ChooseProviderViewModel.kt
@@ -246,7 +246,7 @@ class ChooseProviderViewModel(application: Application) : AndroidViewModel(appli
val providers : LiveData<List<ProviderInfo>> = mutableProviders

internal fun refreshDescription(authority: String) {
viewModelScope.launch {
viewModelScope.launch(singleThreadContext) {
val updatedDescription = ProviderManager.getDescription(getApplication(), authority)
currentProviders[authority]?.let { providerInfo ->
if (providerInfo.description != updatedDescription) {

0 comments on commit 1673a8f

Please sign in to comment.
You can’t perform that action at this time.