Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Commit 7abe28e

Browse files
committed
enhance: implement shutdownInterpreter() to cleanly close console
1 parent 7ac76d1 commit 7abe28e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/main/java/ghidrathon/GhidrathonPlugin.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,31 @@ private void resetInterpreterInBackground() {
159159
inputThread.start();
160160
}
161161

162+
public void shutdownInterpreter() {
163+
if (inputThread != null) {
164+
inputThread.dispose();
165+
inputThread = null;
166+
}
167+
168+
if (console != null) {
169+
console.dispose();
170+
console = null;
171+
}
172+
173+
interactiveScript = null;
174+
interactiveTaskMonitor = null;
175+
176+
// Recreate a new console instance, so Ghidra re-registers it
177+
SwingUtilities.invokeLater(() -> {
178+
console = getTool()
179+
.getService(InterpreterPanelService.class)
180+
.createInterpreterPanel(this, false);
181+
182+
// Let user activate manually
183+
console.addFirstActivationCallback(() -> resetInterpreter());
184+
});
185+
}
186+
162187
class PythonInteractiveTaskMonitor extends TaskMonitorAdapter {
163188

164189
private PrintWriter output = null;

0 commit comments

Comments
 (0)