diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt index c70078a45..de1131371 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt @@ -9,7 +9,6 @@ import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.WebBook import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.asCoroutineDispatcher -import kotlinx.coroutines.cancel import kotlinx.coroutines.delay import java.util.concurrent.Executors @@ -55,7 +54,6 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { } fun stop() { - searchPool.cancel() task?.cancel() } @@ -82,7 +80,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { } override fun onCleared() { - searchPool.close() super.onCleared() + searchPool.close() } } diff --git a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt index cd67d50ec..f3a468da1 100644 --- a/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt @@ -135,7 +135,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio } override fun onCleared() { - searchPool.close() super.onCleared() + searchPool.close() } } \ No newline at end of file