mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 02:34:39 +00:00
fix(DownloadQueue): Fix ConcurrentModificationException
This commit is contained in:
parent
b9f7d18d3d
commit
ea9407b49d
1 changed files with 6 additions and 3 deletions
|
@ -43,7 +43,7 @@ class DownloadQueue(
|
|||
if (download.status == Download.State.DOWNLOADING || download.status == Download.State.QUEUE) {
|
||||
download.status = Download.State.NOT_DOWNLOADED
|
||||
}
|
||||
downloadListeners.forEach { it.updateDownload(download) }
|
||||
callListeners(download)
|
||||
if (removed) {
|
||||
updatedRelay.call(Unit)
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class DownloadQueue(
|
|||
if (download.status == Download.State.DOWNLOADING || download.status == Download.State.QUEUE) {
|
||||
download.status = Download.State.NOT_DOWNLOADED
|
||||
}
|
||||
downloadListeners.forEach { it.updateDownload(download) }
|
||||
callListeners(download)
|
||||
}
|
||||
queue.clear()
|
||||
store.clear()
|
||||
|
@ -102,7 +102,10 @@ class DownloadQueue(
|
|||
}
|
||||
|
||||
private fun callListeners(download: Download) {
|
||||
downloadListeners.forEach { it.updateDownload(download) }
|
||||
val iterator = downloadListeners.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().updateDownload(download)
|
||||
}
|
||||
}
|
||||
|
||||
// private fun setPagesSubject(pages: List<Page>?, subject: PublishSubject<Int>?) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue