Revert: update theOnlyProject field after project dispose because otherwise "projectDisposed" listeners from the other project might get the wrong project

This commit is contained in:
Alexey Kudravtsev
2019-03-29 19:23:03 +03:00
parent af343496f2
commit 599f9f2278
3 changed files with 3 additions and 3 deletions
@@ -3,6 +3,7 @@ package com.intellij.openapi.project.impl;
import com.intellij.openapi.components.ComponentConfig;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.ProjectManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,5 +51,6 @@ final class DefaultProject extends ProjectImpl {
if (LOG.isDebugEnabled()) {
LOG.debug("Disposed DefaultProject "+this);
}
((ProjectManagerImpl)ProjectManager.getInstance()).updateTheOnlyProjectField();
}
}
@@ -29,7 +29,6 @@ import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ex.ProjectEx;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.startup.StartupManager;
@@ -348,8 +347,6 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project
if (!application.isDisposed()) {
application.getMessageBus().syncPublisher(ProjectLifecycleListener.TOPIC).afterProjectClosed(this);
}
((ProjectManagerImpl)ProjectManager.getInstance()).updateTheOnlyProjectField();
TimedReference.disposeTimed();
LaterInvocator.purgeExpiredItems();
}
@@ -459,6 +459,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable {
private void removeFromOpened(@NotNull Project project) {
synchronized (lock) {
myOpenProjects = ArrayUtil.remove(myOpenProjects, project);
updateTheOnlyProjectField();
myOpenProjectByHash.values().remove(project); // remove by value and not by key!
}
}