JAL-1115 refactor base collection for Alignment from Vector to locally synchronized...
[jalview.git] / src / jalview / gui / PaintRefresher.java
index 9dc7f32..219fbf8 100755 (executable)
@@ -18,6 +18,7 @@
 package jalview.gui;
 
 import java.util.*;
+import java.util.List;
 
 import java.awt.*;
 
@@ -179,7 +180,16 @@ public class PaintRefresher
       {
         if (i < comp.getHeight())
         {
-          comp.getSequences().insertElementAt(a1[i], i);
+          // TODO: the following does not trigger any recalculation of height/etc, or maintain the dataset
+          if (comp.getDataset()!=source.getDataset())
+          {
+            // raise an implementation warning here - not sure if this situation will ever occur
+            System.err.println("IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)");
+          }
+          List<SequenceI> alsq;
+          synchronized (alsq=comp.getSequences()) {
+            alsq.add(i, a1[i]);
+          }
         }
         else
         {