project leaks: keep a list of started "scan file system" futures and kill em all at once

This commit is contained in:
Alexey Kudravtsev
2017-02-08 18:13:47 +03:00
parent fe4e38ca8f
commit 871ddc8085
@@ -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);
}