mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/GP-289_ghidravore_gtree_dispose_issue--SQUASHED' into Ghidra_9.2
This commit is contained in:
commit
cefacd49be
3 changed files with 23 additions and 15 deletions
|
@ -1171,7 +1171,10 @@ class FSBActionManager {
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
FSRL containerFSRL = FSBUtils.getFileFSRLFromContext(context);
|
FSRL containerFSRL = FSBUtils.getFileFSRLFromContext(context);
|
||||||
if (containerFSRL != null && context.getContextObject() instanceof FSBFileNode) {
|
if (containerFSRL != null && context.getContextObject() instanceof FSBFileNode) {
|
||||||
FSBFileNode fileNode = (FSBFileNode) context.getContextObject();
|
FSBFileNode xfileNode = (FSBFileNode) context.getContextObject();
|
||||||
|
FSBFileNode modelFileNode =
|
||||||
|
(FSBFileNode) gTree.getModelNodeForPath(xfileNode.getTreePath());
|
||||||
|
|
||||||
gTree.runTask(monitor -> {
|
gTree.runTask(monitor -> {
|
||||||
try {
|
try {
|
||||||
FileSystemRef fsRef =
|
FileSystemRef fsRef =
|
||||||
|
@ -1185,17 +1188,12 @@ class FSBActionManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSBRootNode nestedRootNode = new FSBRootNode(fsRef, fileNode);
|
FSBRootNode nestedRootNode = new FSBRootNode(fsRef, modelFileNode);
|
||||||
FSBRootNode containingFSBRootNode =
|
|
||||||
FSBNode.findContainingFileSystemFSBRootNode(fileNode);
|
|
||||||
if (containingFSBRootNode != null) {
|
|
||||||
containingFSBRootNode.getSubRootNodes().add(nestedRootNode);
|
|
||||||
}
|
|
||||||
nestedRootNode.setChildren(nestedRootNode.generateChildren(monitor));
|
nestedRootNode.setChildren(nestedRootNode.generateChildren(monitor));
|
||||||
|
|
||||||
int indexInParent = fileNode.getIndexInParent();
|
int indexInParent = modelFileNode.getIndexInParent();
|
||||||
GTreeNode parent = fileNode.getParent();
|
GTreeNode parent = modelFileNode.getParent();
|
||||||
parent.removeNode(fileNode);
|
parent.removeNode(modelFileNode);
|
||||||
parent.addNode(indexInParent, nestedRootNode);
|
parent.addNode(indexInParent, nestedRootNode);
|
||||||
gTree.expandPath(nestedRootNode);
|
gTree.expandPath(nestedRootNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,6 +260,11 @@ abstract class CoreGTreeNode implements Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used to dispose filtered "clone" nodes. When a filter is applied to the tree,
|
||||||
|
* the nodes that matched are "shallow" cloned, so when the filter is removed, we don't
|
||||||
|
* want to do a full dispose on the nodes, just clean up the parent-child references.
|
||||||
|
*/
|
||||||
final void disposeClones() {
|
final void disposeClones() {
|
||||||
List<GTreeNode> oldChildren;
|
List<GTreeNode> oldChildren;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
|
@ -243,12 +243,17 @@ public class GTree extends JPanel implements BusyListener {
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
filterUpdateManager.dispose();
|
filterUpdateManager.dispose();
|
||||||
worker.dispose();
|
worker.dispose();
|
||||||
GTreeNode root = model.getModelRoot();
|
|
||||||
if (root != null) {
|
if (realModelRootNode != null) {
|
||||||
root.dispose();
|
|
||||||
}
|
|
||||||
realModelRootNode.dispose();
|
realModelRootNode.dispose();
|
||||||
realViewRootNode.dispose();
|
}
|
||||||
|
// if there is a filter applied, clean up the filtered nodes. Note that filtered nodes
|
||||||
|
// are expected to be shallow clones of the model nodes, so we don't want to call full
|
||||||
|
// dispose on the filtered nodes because internal clean-up should happen when the
|
||||||
|
// model nodes are disposed. The disposeClones just breaks the child-parent ties.
|
||||||
|
if (realViewRootNode != null && realViewRootNode != realModelRootNode) {
|
||||||
|
realViewRootNode.disposeClones();
|
||||||
|
}
|
||||||
model.dispose();
|
model.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue