Merge pull request #3724 from ByteHamster/fix-concurrent-modification

Only modify and query downloads array in main thread
This commit is contained in:
H. Lehmann 2020-01-03 23:10:35 +01:00 committed by GitHub
commit cf580cfbbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -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,