From 6505694e95a599f0f47742a12366ccbcb34752eb Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 10 Mar 2017 20:06:57 +0300 Subject: [PATCH] project/threads leaks in tests --- .../openapi/vcs/changes/ChangeListManagerImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index 353cd852d85d..d6a04a61c895 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -27,6 +27,8 @@ import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.progress.*; import com.intellij.openapi.project.DumbAwareRunnable; import com.intellij.openapi.project.Project; +import com.intellij.openapi.project.ProjectManager; +import com.intellij.openapi.project.ProjectManagerListener; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy; @@ -154,6 +156,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec } } }); + if (ApplicationManager.getApplication().isUnitTestMode()) { + ProjectManager.getInstance().addProjectManagerListener(project, new ProjectManagerListener() { + @Override + public void projectClosing(Project project) { + waitEverythingDoneInTestMode(); + } + }); + } } private void scheduleAutomaticChangeListDeletionIfEmpty(final LocalChangeList oldList, final VcsConfiguration config) {