JAL-2649 JAL-2650 wait for Conservation calc to complete before setting
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index 5a7a27f..70f16d9 100644 (file)
@@ -641,6 +641,20 @@ public abstract class AlignmentViewport implements AlignViewportI,
     {
       if (getConservationSelected())
       {
+        int retry = 0;
+        synchronized (this)
+        {
+          while (isCalcInProgress() && retry < 10)
+          {
+            try
+            {
+              wait(50);
+              retry++;
+            } catch (InterruptedException e)
+            {
+            }
+          }
+        }
         residueShading.setConservation(hconservation);
       }
       residueShading.alignmentChanged(alignment, hiddenRepSequences);