From 1bcbae9de76f840ebee4273054d256fe2089d88f Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 2 Aug 2022 08:50:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E8=B6=85=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E8=A7=A6=E5=8F=91=E5=8F=96=E6=B6=88=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BA=86,onFinal=E4=BC=9A=E6=AD=A3=E5=B8=B8=E8=A7=A6=E5=8F=91,?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E4=BB=BB=E5=8A=A1=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=B8=8D=E8=A7=A6=E5=8F=91onFinal,=E9=98=B2=E6=AD=A2=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=80=E5=87=BA=E5=90=8E=E4=BB=8D=E7=84=B6=E6=89=A7?= =?UTF-8?q?=E8=A1=8ConFinal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt index ce2731f64..73f8f9edf 100644 --- a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt +++ b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt @@ -148,7 +148,7 @@ class Coroutine( success?.let { dispatchCallback(this, value, it) } } catch (e: Throwable) { e.printOnDebug() - if (e is CancellationException && !isActive && e !is ActivelyCancelException) { + if (e is CancellationException && e !is ActivelyCancelException && isCancelled) { this@Coroutine.cancel() } val consume: Boolean = errorReturn?.value?.let { value -> @@ -159,9 +159,7 @@ class Coroutine( error?.let { dispatchCallback(this, e, it) } } } finally { - withContext(NonCancellable) { - finally?.let { dispatchVoidCallback(this, it) } - } + finally?.let { dispatchVoidCallback(this, it) } } } }