jshell: run cleanups on the client thread

This commit is contained in:
Max Weber
2021-07-16 15:52:57 -06:00
committed by Abex
parent 48c6434e6d
commit de8940b8b9

View File

@@ -419,7 +419,12 @@ public abstract class ShellPanel extends JPanel
private void cleanup() private void cleanup()
{ {
for (var c : cleanup) var todo = new ArrayList<>(cleanup);
cleanup.clear();
invokeOnClientThread(() ->
{
for (var c : todo)
{ {
try try
{ {
@@ -430,7 +435,7 @@ public abstract class ShellPanel extends JPanel
shellLogger.error("Cleanup threw:", e); shellLogger.error("Cleanup threw:", e);
} }
} }
cleanup.clear(); });
} }
protected abstract void invokeOnClientThread(Runnable r); protected abstract void invokeOnClientThread(Runnable r);