From 871ddc80853b58aa8da7e8e51157b3d9ab3e3727 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 8 Feb 2017 17:38:57 +0300 Subject: [PATCH] project leaks: keep a list of started "scan file system" futures and kill em all at once --- .../openapi/progress/util/ProgressIndicatorUtils.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressIndicatorUtils.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressIndicatorUtils.java index 6ddfe9195d3b..c2b0a5994c47 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressIndicatorUtils.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressIndicatorUtils.java @@ -174,7 +174,7 @@ public class ProgressIndicatorUtils { CompletableFuture future = new CompletableFuture<>(); //noinspection SSBasedInspection EdtInvocationManager.getInstance().invokeLater(() -> { - if (application.isDisposed()) { + if (application.isDisposed() || progressIndicator.isCanceled()) { future.complete(null); return; } @@ -193,7 +193,14 @@ public class ProgressIndicatorUtils { executor.execute(new Runnable() { @Override public void run() { - final ReadTask.Continuation continuation = runUnderProgress(progressIndicator, readTask); + final ReadTask.Continuation continuation; + try { + continuation = runUnderProgress(progressIndicator, readTask); + } + catch (Throwable e) { + future.completeExceptionally(e); + throw e; + } if (continuation == null) { future.complete(null); }