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);
}
private void dispose() {
@Override
public void dispose() {
Swing.runLater(() -> tool.removeListenerForAllPluginEvents(this));
program.removeListener(this);
}

View file

@ -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

View file

@ -39,4 +39,9 @@ public class DummyGraphDisplayListener implements GraphDisplayListener {
// 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);
/**
* 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");
}
@Override
public void dispose() {
// do nothing
}
}
private AttributedGraph createGraph() {