JAL-2902 catch case where viewer is closed (therefore binding is null) before hasMapp...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 7 Feb 2018 16:48:22 +0000 (16:48 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 7 Feb 2018 16:50:39 +0000 (16:50 +0000)
src/jalview/gui/StructureViewerBase.java

index 891e771..93d675a 100644 (file)
@@ -103,9 +103,9 @@ public abstract class StructureViewerBase extends GStructureViewer
 
   protected boolean alignAddedStructures = false;
 
-  protected boolean _started = false;
+  protected volatile boolean _started = false;
 
-  protected boolean addingStructures = false;
+  protected volatile boolean addingStructures = false;
 
   protected Thread worker = null;
 
@@ -118,7 +118,7 @@ public abstract class StructureViewerBase extends GStructureViewer
    * used to determine if the final sequence/structure mapping has been
    * determined
    */
-  protected boolean seqColoursApplied = false;
+  protected volatile boolean seqColoursApplied = false;
 
   /**
    * Default constructor
@@ -1047,6 +1047,11 @@ public abstract class StructureViewerBase extends GStructureViewer
     }
     if (getBinding() == null)
     {
+      if (_aps == null || _aps.size() == 0)
+      {
+        // viewer has been closed, but we did at some point run.
+        return true;
+      }
       return false;
     }
     String[] pdbids = getBinding().getStructureFiles();