JAL-3878 Wrap infoPanel updates with SwingUtilities.invokeLater
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 25 Mar 2022 17:56:37 +0000 (18:56 +0100)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 25 Mar 2022 17:56:37 +0000 (18:56 +0100)
src/jalview/ws2/gui/AlignmentServiceGuiHandler.java

index 2540dd1..61673f9 100644 (file)
@@ -11,6 +11,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
 
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
@@ -134,9 +135,10 @@ class AlignmentServiceGuiHandler
   @Override
   public void taskCompleted(TaskI<AlignmentResult> source, AlignmentResult result)
   {
+    SwingUtilities.invokeLater(() -> infoPanel.removeProgressBar(jobs[0].getInternalId()));
     if (result == null)
     {
-      infoPanel.setFinishedNoResults();
+      SwingUtilities.invokeLater(infoPanel::setFinishedNoResults);
       return;
     }
     infoPanel.showResultsNewFrame.addActionListener(evt -> {
@@ -148,7 +150,7 @@ class AlignmentServiceGuiHandler
       displayResultsNewFrame(alnCpy, result.getAlignmentOrders(),
           result.getHiddenColumns());
     });
-    infoPanel.setResultsReady();
+    SwingUtilities.invokeLater(infoPanel::setResultsReady);
   }
 
   private void displayResultsNewFrame(Alignment aln,