From 91a84d812ca590baf3079a8309449f5e8420c0f8 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Sun, 21 Mar 2021 00:07:27 +0900 Subject: [PATCH] Run Leelaz.parseLine at event dispatch thread --- src/main/java/featurecat/lizzie/analysis/Leelaz.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/featurecat/lizzie/analysis/Leelaz.java b/src/main/java/featurecat/lizzie/analysis/Leelaz.java index 29c2323b..6f14ea8a 100644 --- a/src/main/java/featurecat/lizzie/analysis/Leelaz.java +++ b/src/main/java/featurecat/lizzie/analysis/Leelaz.java @@ -22,6 +22,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; import org.json.JSONException; import org.json.JSONObject; @@ -466,7 +467,8 @@ private void read() { while ((c = inputStream.read()) != -1) { line.append((char) c); if ((c == '\n')) { - parseLine(line.toString()); + String cmd = line.toString(); + SwingUtilities.invokeLater(() -> parseLine(cmd)); line = new StringBuilder(); } }