From e2f099e548ecbbc55400906ef264a36d0cc4056e Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 8 Feb 2017 15:52:13 +0100 Subject: [PATCH] [platform] checks 'ProgressIndicator.isCanceled()' right before finishing a task --- .../openapi/progress/impl/CoreProgressManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java index 3316db3ca07f..0a79d7a33dc6 100644 --- a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java +++ b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -473,17 +473,16 @@ public class CoreProgressManager extends ProgressManager implements Disposable { exception = e; } - final boolean finalCanceled = processCanceled || progressIndicator.isCanceled(); - final Throwable finalException = exception; - if (ApplicationManager.getApplication().isDispatchThread()) { - finishTask(task, finalCanceled, finalException); + finishTask(task, processCanceled || progressIndicator.isCanceled(), exception); } else { + final boolean finalCanceled = processCanceled; + final Throwable finalException = exception; ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { - finishTask(task, finalCanceled, finalException); + finishTask(task, finalCanceled || progressIndicator.isCanceled(), finalException); } }, modalityState); }