Only cancel the install of the extension being cancelled

This commit is contained in:
AntsyLich
2026-10-12 13:56:33 +06:00
parent 649fc83ffa
commit ae749bb4f8
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -42,6 +42,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Fixed a crash when updating an extension while others were installing ([@AntsyLich](https://github.com/AntsyLich))
- Fixed library entries without a date added getting their last update time as date added when updating from v0.20.x ([@AntsyLich](https://github.com/AntsyLich))
- Fixed the app closing when WebView's page process crashed ([@AntsyLich](https://github.com/AntsyLich))
- Fixed installing or updating an extension sometimes cancelling the install of another one ([@AntsyLich](https://github.com/AntsyLich))
## [v0.21.0] - 2026-10-12
### Added
@@ -127,8 +127,10 @@ abstract class Installer(private val service: Service) {
*/
private fun cancelQueue(downloadId: Long) {
val waitingInstall = this.waitingInstall.load()
// Every new install cancels its own previous attempt first, which mustn't hit another extension's install
val toCancel = synchronized(queue) { queue.find { it.downloadId == downloadId } }
?: waitingInstall ?: return
?: waitingInstall?.takeIf { it.downloadId == downloadId }
?: return
if (cancelEntry(toCancel)) {
queue.remove(toCancel)
if (waitingInstall == toCancel) {