Skip to content

Ghidra is a software reverse engineering (SRE) framework

fixed stack trace when exporting

ghidravore1259632113cd
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java
index 0e6b40ca8b..71447e37b4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/graph/AddressBasedGraphDisplayListener.java
@@ -222,7 +222,8 @@ public abstract class AddressBasedGraphDisplayListener
graphDisplay.updateVertexName(vertex, displayName);
}
- private void dispose() {
+ @Override
+ public void dispose() {
Swing.runLater(() -> tool.removeListenerForAllPluginEvents(this));
program.removeListener(this);
}
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/ExportAttributedGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/ExportAttributedGraphDisplay.java
index 51cbca873b..c75c8caa67 100644
--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/ExportAttributedGraphDisplay.java
+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/ExportAttributedGraphDisplay.java
@@ -39,6 +39,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
private final PluginTool pluginTool;
private String title;
+ private AttributedGraph graph;
/**
* Create the initial display, the graph-less visualization viewer, and its controls
@@ -55,7 +56,8 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
@Override
public void setGraphDisplayListener(GraphDisplayListener listener) {
- // This display is not interactive, so N/A
+ // This display is not interactive, so just dispose the listener
+ listener.dispose();
}
@@ -86,10 +88,11 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
}
@Override
- public void setGraph(AttributedGraph graphData, String title, boolean append,
+ public void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor) {
this.title = title;
- doSetGraphData(graphData);
+ this.graph = graph;
+ doSetGraphData(graph);
}
/**
@@ -132,7 +135,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
@Override
public AttributedGraph getGraph() {
- return null;
+ return graph;
}
@Override
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/DummyGraphDisplayListener.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/DummyGraphDisplayListener.java
index 11b056fcbb..22ad336d75 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/DummyGraphDisplayListener.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/DummyGraphDisplayListener.java
@@ -39,4 +39,9 @@ public class DummyGraphDisplayListener implements GraphDisplayListener {
// I'm a dummy
}
+ @Override
+ public void dispose() {
+ // I'm a dummy
+ }
+
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphDisplayListener.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphDisplayListener.java
index c763ea3977..0902fe8ca0 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphDisplayListener.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphDisplayListener.java
@@ -49,4 +49,9 @@ public interface GraphDisplayListener {
*/
public GraphDisplayListener cloneWith(GraphDisplay graphDisplay);
+ /**
+ * Tells the listener that it is no longer needed and it can release any listeners/resources
+ */
+ public void dispose();
+
}
diff --git a/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java
index 39584dd51d..1bdfe9d870 100644
--- a/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java
@@ -303,6 +303,11 @@ public class GraphActionTest extends AbstractGhidraHeadedIntegrationTest {
return new TestGraphDisplayListener("clone");
}
+ @Override
+ public void dispose() {
+ // do nothing
+ }
+
}
private AttributedGraph createGraph() {