mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
[external system][IDEA-349206] fix ProjectNode leak
GitOrigin-RevId: f4bdd494035d2a4d082e30e870a88c81b7fb4949
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1a219c043b
commit
5b176dd7f0
+4
-2
@@ -145,7 +145,7 @@ public class ExternalProjectsStructure extends SimpleTreeStructure implements Di
|
||||
final ExternalSystemNode<?>[] cached = currentNode.getCached();
|
||||
if (cached == null) {
|
||||
//noinspection unchecked
|
||||
currentNode.mergeWith(newNode);
|
||||
currentNode.setFrom(newNode);
|
||||
return;
|
||||
}
|
||||
final List<Object> duplicates = new ArrayList<>();
|
||||
@@ -158,7 +158,9 @@ public class ExternalProjectsStructure extends SimpleTreeStructure implements Di
|
||||
}
|
||||
}
|
||||
|
||||
// new data comparing to old node
|
||||
Map<Object, ExternalSystemNode<?>> newDataMap = new LinkedHashMap<>();
|
||||
// old nodes that exist in the old node as well as in the new node
|
||||
Map<Object, ExternalSystemNode<?>> unchangedNewDataMap = new LinkedHashMap<>();
|
||||
for (ExternalSystemNode<?> node : newNode.getChildren()) {
|
||||
Object key = node.getData() != null ? node.getData() : node.getName();
|
||||
@@ -186,7 +188,7 @@ public class ExternalProjectsStructure extends SimpleTreeStructure implements Di
|
||||
|
||||
updateFrom(currentNode);
|
||||
//noinspection unchecked
|
||||
currentNode.mergeWith(newNode);
|
||||
currentNode.setFrom(newNode);
|
||||
currentNode.addAll(newDataMap.values());
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -424,7 +424,8 @@ public abstract class ExternalSystemNode<T> extends SimpleNode implements Compar
|
||||
return StringUtil.compare(this.getName(), node.getName(), true);
|
||||
}
|
||||
|
||||
public void mergeWith(ExternalSystemNode<T> node) {
|
||||
setDataNode(node.myDataNode);
|
||||
public void setFrom(@NotNull ExternalSystemNode<T> newNode) {
|
||||
setDataNode(newNode.myDataNode);
|
||||
setParent(newNode.myParent);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -116,11 +116,10 @@ public class ModuleNode extends ExternalSystemNode<ModuleData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergeWith(ExternalSystemNode<ModuleData> node) {
|
||||
super.mergeWith(node);
|
||||
ModuleNode moduleNode = node instanceof ModuleNode ? ((ModuleNode)node) : null;
|
||||
if (moduleNode != null) {
|
||||
myAllModules = moduleNode.myAllModules;
|
||||
public void setFrom(@NotNull ExternalSystemNode<ModuleData> node) {
|
||||
super.setFrom(node);
|
||||
if (node instanceof ModuleNode moduleNode) {
|
||||
myAllModules = moduleNode.myAllModules;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user