fixed stack trace when exporting

This commit is contained in:
ghidravore 2020-11-25 13:11:16 -05:00
parent 4300bec382
commit 1259632113
5 changed files with 24 additions and 5 deletions

View file

@ -222,7 +222,8 @@ public abstract class AddressBasedGraphDisplayListener
graphDisplay.updateVertexName(vertex, displayName); graphDisplay.updateVertexName(vertex, displayName);
} }
private void dispose() { @Override
public void dispose() {
Swing.runLater(() -> tool.removeListenerForAllPluginEvents(this)); Swing.runLater(() -> tool.removeListenerForAllPluginEvents(this));
program.removeListener(this); program.removeListener(this);
} }

View file

@ -39,6 +39,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
private final PluginTool pluginTool; private final PluginTool pluginTool;
private String title; private String title;
private AttributedGraph graph;
/** /**
* Create the initial display, the graph-less visualization viewer, and its controls * Create the initial display, the graph-less visualization viewer, and its controls
@ -55,7 +56,8 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
@Override @Override
public void setGraphDisplayListener(GraphDisplayListener listener) { 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 @Override
public void setGraph(AttributedGraph graphData, String title, boolean append, public void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor) { TaskMonitor monitor) {
this.title = title; this.title = title;
doSetGraphData(graphData); this.graph = graph;
doSetGraphData(graph);
} }
/** /**
@ -132,7 +135,7 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
@Override @Override
public AttributedGraph getGraph() { public AttributedGraph getGraph() {
return null; return graph;
} }
@Override @Override

View file

@ -39,4 +39,9 @@ public class DummyGraphDisplayListener implements GraphDisplayListener {
// I'm a dummy // I'm a dummy
} }
@Override
public void dispose() {
// I'm a dummy
}
} }

View file

@ -49,4 +49,9 @@ public interface GraphDisplayListener {
*/ */
public GraphDisplayListener cloneWith(GraphDisplay graphDisplay); public GraphDisplayListener cloneWith(GraphDisplay graphDisplay);
/**
* Tells the listener that it is no longer needed and it can release any listeners/resources
*/
public void dispose();
} }

View file

@ -303,6 +303,11 @@ public class GraphActionTest extends AbstractGhidraHeadedIntegrationTest {
return new TestGraphDisplayListener("clone"); return new TestGraphDisplayListener("clone");
} }
@Override
public void dispose() {
// do nothing
}
} }
private AttributedGraph createGraph() { private AttributedGraph createGraph() {