JAL-4298 avoid deadlock waiting to update doc when doc is being used by gui thread...
authorJames Procter <j.procter@dundee.ac.uk>
Thu, 19 Oct 2023 17:33:57 +0000 (18:33 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Thu, 19 Oct 2023 17:33:57 +0000 (18:33 +0100)
src/jalview/gui/Console.java

index 6a6cb56..9fe7195 100644 (file)
@@ -683,12 +683,16 @@ public class Console extends WindowAdapter
               displayPipe = tmp;
             }
             // simply append whole buffer
-            textArea.append(replace.toString());
-            count += replace.length();
-            if (count > byteslim)
+            synchronized (textArea.getDocument())
             {
-              trimBuffer(false);
+              textArea.append(replace.toString());
+              count += replace.length();
+              if (count > byteslim)
+              {
+                trimBuffer(false);
+              }
             }
+            
           }
           if (displayPipe.length() == 0)
           {