Fix ConcurrentModificationException caused by coroutines
This commit is contained in:
@@ -13,6 +13,7 @@ class RecipePagingSourceFactory @Inject constructor(
|
|||||||
) : () -> PagingSource<Int, RecipeSummaryEntity> {
|
) : () -> PagingSource<Int, RecipeSummaryEntity> {
|
||||||
private val sources: MutableList<PagingSource<Int, RecipeSummaryEntity>> = mutableListOf()
|
private val sources: MutableList<PagingSource<Int, RecipeSummaryEntity>> = mutableListOf()
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
override fun invoke(): PagingSource<Int, RecipeSummaryEntity> {
|
override fun invoke(): PagingSource<Int, RecipeSummaryEntity> {
|
||||||
Timber.v("invoke() called")
|
Timber.v("invoke() called")
|
||||||
val newSource = recipeStorage.queryRecipes()
|
val newSource = recipeStorage.queryRecipes()
|
||||||
@@ -20,6 +21,7 @@ class RecipePagingSourceFactory @Inject constructor(
|
|||||||
return newSource
|
return newSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
fun invalidate() {
|
fun invalidate() {
|
||||||
Timber.v("invalidate() called")
|
Timber.v("invalidate() called")
|
||||||
for (source in sources) {
|
for (source in sources) {
|
||||||
|
|||||||
Reference in New Issue
Block a user