Merge pull request #3724 from ByteHamster/fix-concurrent-modification
Only modify and query downloads array in main thread
This commit is contained in:
commit
cf580cfbbd
|
@ -477,13 +477,13 @@ public class DownloadService extends Service {
|
|||
&& isEnqueued(request, itemsEnqueued)) {
|
||||
request.setMediaEnqueued(true);
|
||||
}
|
||||
downloads.add(downloader);
|
||||
downloadExecutor.submit(downloader);
|
||||
|
||||
postDownloaders();
|
||||
handler.post(() -> {
|
||||
downloads.add(downloader);
|
||||
downloadExecutor.submit(downloader);
|
||||
postDownloaders();
|
||||
});
|
||||
}
|
||||
|
||||
queryDownloads();
|
||||
handler.post(this::queryDownloads);
|
||||
}
|
||||
|
||||
private static boolean isEnqueued(@NonNull DownloadRequest request,
|
||||
|
|
Loading…
Reference in New Issue