From: Jim Procter Date: Wed, 7 Feb 2018 16:48:22 +0000 (+0000) Subject: JAL-2902 catch case where viewer is closed (therefore binding is null) before hasMapp... X-Git-Tag: Release_2_10_4~68^2~29 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=264fe1353379ffc6e90dee9d107b15f30da40737;p=jalview.git JAL-2902 catch case where viewer is closed (therefore binding is null) before hasMapping is called. technically, hasMapping should return falseā€¦ but not if it is being used to poll. --- diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index 891e771..93d675a 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -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();