0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00

Fix hang when syncing media in new schema

Media syncing does not require a collection lock, and was mistakenly
holding one.

Probably closes #12912
This commit is contained in:
Damien Elmes 2022-12-02 12:27:58 +10:00 committed by Brayan Oliveira
parent 854f328f6b
commit 1ebdb73dee

View File

@ -249,7 +249,8 @@ private suspend fun handleMediaSync(
.setPositiveButton("Background") { _, _ -> }
.show()
try {
CollectionManager.getBackend().withProgress(
val backend = CollectionManager.getBackend()
backend.withProgress(
extractProgress = {
if (progress.hasMediaSync()) {
text =
@ -260,9 +261,7 @@ private suspend fun handleMediaSync(
dialog.setMessage(text)
},
) {
withCol {
newBackend.syncMedia(auth)
}
backend.syncMedia(auth)
}
} finally {
dialog.dismiss()