From f411449b59b0a7369f6f77cd1a78b7417e36ab50 Mon Sep 17 00:00:00 2001 From: James Procter Date: Thu, 19 Oct 2023 18:33:57 +0100 Subject: [PATCH] JAL-4298 avoid deadlock waiting to update doc when doc is being used by gui thread waiting for thread to update the doc --- src/jalview/gui/Console.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index 6a6cb56..9fe7195 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -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) { -- 1.7.10.2