patch for JAL-699 so conservation/consensus threads restart correctly
authorjprocter <Jim Procter>
Fri, 12 Nov 2010 14:59:48 +0000 (14:59 +0000)
committerjprocter <Jim Procter>
Fri, 12 Nov 2010 14:59:48 +0000 (14:59 +0000)
src/jalview/appletgui/AlignViewport.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/ConservationThread.java

index 804b590..6d6a3e6 100755 (executable)
@@ -371,9 +371,11 @@ public class AlignViewport
 
         UPDATING_CONSERVATION = true;
 
-        int alWidth = alignment.getWidth();
+        int alWidth = (alignment==null) ? -1 : alignment.getWidth();
         if (alWidth < 0)
         {
+          updatingConservation = false;
+          UPDATING_CONSERVATION = false;
           return;
         }
 
@@ -548,9 +550,11 @@ public class AlignViewport
 
       try
       {
-        int aWidth = alignment.getWidth();
+        int aWidth = alignment==null ? -1 : alignment.getWidth();
         if (aWidth < 0)
         {
+          UPDATING_CONSENSUS = false;
+          updatingConsensus = false;
           return;
         }
 
index 6f713fc..ef7d35c 100755 (executable)
@@ -539,12 +539,14 @@ public class AlignViewport implements SelectionSource
 
       try
       {
-        int aWidth = (alignment != null) ? alignment.getWidth() : 0; // null
+        int aWidth = (alignment != null) ? alignment.getWidth() : -1; // null
         // pointer
         // possibility
         // here.
-        if (aWidth < 0)
+        if (aWidth <= 0)
         {
+          updatingConsensus = false;
+          UPDATING_CONSENSUS = false;
           return;
         }
 
index fa70bcc..5ed536c 100644 (file)
@@ -60,9 +60,12 @@ class ConservationThread extends Thread
 
       AlignViewport.UPDATING_CONSERVATION = true;
 
-      int alWidth = this.alignViewport.alignment.getWidth();
-      if (alWidth < 0)
+      int alWidth;
+      
+      if (alignViewport==null || alignViewport.alignment==null || (alWidth=alignViewport.alignment.getWidth())< 0)
       {
+        this.alignViewport.updatingConservation = false;
+        AlignViewport.UPDATING_CONSERVATION = false;
         return;
       }
 
@@ -85,7 +88,6 @@ class ConservationThread extends Thread
 
       this.alignViewport.conservation = null;
       this.alignViewport.quality = null;
-
     }
 
     AlignViewport.UPDATING_CONSERVATION = false;