From a89ce4c590e75b45e45df38cbb152b6f6e1f1c71 Mon Sep 17 00:00:00 2001 From: Sergey Rostov Date: Tue, 29 Oct 2019 14:24:54 +0300 Subject: [PATCH] BackgroundExecutor: cancel all tasks on user cancel, remove useless updateProgress call --- .../core/script/configuration/utils/BackgroundExecutor.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/BackgroundExecutor.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/BackgroundExecutor.kt index 4ec9a9634f8..ea1043949aa 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/BackgroundExecutor.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/BackgroundExecutor.kt @@ -70,8 +70,6 @@ internal class BackgroundExecutor( if (queue.add(task)) { debug(task.key) { "added to update queue" } - updateProgress() - // If the queue is longer than PROGRESS_INDICATOR_MIN_QUEUE, show progress and cancel button if (queue.size > PROGRESS_INDICATOR_MIN_QUEUE) { requireUnderProgressWorker() @@ -170,7 +168,11 @@ internal class BackgroundExecutor( val next = synchronized(this@BackgroundExecutor) { if (shouldStop) return - if (checkCancelled() || queue.isEmpty()) { + if (checkCancelled()) { + queue.clear() + endBatch() + return + } else if (queue.isEmpty()) { endBatch() return }