From 4904dd117c340d618239037432bea8964e2a56f6 Mon Sep 17 00:00:00 2001 From: hoodie13 <74173949+hoodie13@users.noreply.github.com> Date: Sat, 6 Mar 2021 19:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2=E4=B9=A6?= =?UTF-8?q?=E7=B1=8D=E6=88=96=E8=80=85=E7=AB=A0=E8=8A=82=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=E7=9C=8B=E6=BC=AB=E7=94=BB=E5=AE=B9=E6=98=93=E5=A4=8D=E7=8E=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clearCache增加保护。因漫画图片loadContent耗时较长,此时其他操作启用新的协程loadContent容易撞到clear和setCache干扰导致signal 11崩溃。 --- .../io/legado/app/ui/book/read/page/provider/ImageProvider.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt index c269a7e55..c124d48a6 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt @@ -61,6 +61,7 @@ object ImageProvider { } } + @Synchronized fun clearAllCache() { cache.forEach { indexCache -> indexCache.value.forEach { @@ -70,6 +71,7 @@ object ImageProvider { cache.clear() } + @Synchronized fun clearOut(chapterIndex: Int) { cache.forEach { indexCache -> if (indexCache.key !in chapterIndex - 1..chapterIndex + 1) {