JAL-4298 avoid deadlock waiting to update doc when doc is being used by gui thread...
[jalview.git] / 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)
           {