From 59c35fe35cfdbbd4be0872afed5e23ada7df1629 Mon Sep 17 00:00:00 2001 From: Sergey Rostov Date: Thu, 7 May 2020 15:45:26 +0300 Subject: [PATCH] ScriptClassRootsUpdater: fix clearing scheduledUpdate and check cancelled in sync --- .../configuration/utils/ScriptClassRootsUpdater.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt index 64a3d5b6b2d..ac118f3cacd 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/utils/ScriptClassRootsUpdater.kt @@ -123,12 +123,14 @@ class ScriptClassRootsUpdater( fun doUpdate(underProgressManager: Boolean = true) { syncLock.withLock { - val updates = manager.collectRootsAndCheckNew() - - if (!updates.changed) return - try { - ProgressManager.checkCanceled() + val updates = manager.collectRootsAndCheckNew() + + if (!updates.changed) return + + if (underProgressManager) { + ProgressManager.checkCanceled() + } if (updates.hasNewRoots) { notifyRootsChanged()