0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +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") { _, _ -> } .setPositiveButton("Background") { _, _ -> }
.show() .show()
try { try {
CollectionManager.getBackend().withProgress( val backend = CollectionManager.getBackend()
backend.withProgress(
extractProgress = { extractProgress = {
if (progress.hasMediaSync()) { if (progress.hasMediaSync()) {
text = text =
@ -260,9 +261,7 @@ private suspend fun handleMediaSync(
dialog.setMessage(text) dialog.setMessage(text)
}, },
) { ) {
withCol { backend.syncMedia(auth)
newBackend.syncMedia(auth)
}
} }
} finally { } finally {
dialog.dismiss() dialog.dismiss()