mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] cancel indicators that are started after VcsLogProgress is disposed
This commit is contained in:
@@ -35,6 +35,7 @@ public class VcsLogProgress implements Disposable {
|
||||
@NotNull private final List<ProgressListener> myListeners = ContainerUtil.newArrayList();
|
||||
@NotNull private final Set<ProgressIndicator> myTasksWithVisibleProgress = ContainerUtil.newHashSet();
|
||||
@NotNull private final Set<ProgressIndicator> myTasksWithSilentProgress = ContainerUtil.newHashSet();
|
||||
private boolean myDisposed = false;
|
||||
|
||||
public VcsLogProgress(@NotNull Project project, @NotNull Disposable parent) {
|
||||
Disposer.register(parent, () -> Disposer.dispose(this));
|
||||
@@ -78,6 +79,10 @@ public class VcsLogProgress implements Disposable {
|
||||
|
||||
private void started(@NotNull VcsLogProgressIndicator indicator) {
|
||||
synchronized (myLock) {
|
||||
if (myDisposed) {
|
||||
indicator.cancel();
|
||||
return;
|
||||
}
|
||||
if (indicator.isVisible()) {
|
||||
myTasksWithVisibleProgress.add(indicator);
|
||||
if (myTasksWithVisibleProgress.size() == 1) fireNotification(ProgressListener::progressStarted);
|
||||
@@ -110,6 +115,7 @@ public class VcsLogProgress implements Disposable {
|
||||
@Override
|
||||
public void dispose() {
|
||||
synchronized (myLock) {
|
||||
myDisposed = true;
|
||||
for (ProgressIndicator indicator : myTasksWithVisibleProgress) {
|
||||
indicator.cancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user