X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FConservationThread.java;h=54b0191169f79e21eebc431d55d75c3dbf5efc9c;hb=ea7aa18440e6140ec7485e6cefdfb1dffb945580;hp=1075e4d16e2cade70706bdf56b329f25c4ea7b03;hpb=8fe8fc5ad87962f2cc74f4ab368b114b4c17859e;p=jalview.git diff --git a/src/jalview/workers/ConservationThread.java b/src/jalview/workers/ConservationThread.java index 1075e4d..54b0191 100644 --- a/src/jalview/workers/ConservationThread.java +++ b/src/jalview/workers/ConservationThread.java @@ -55,7 +55,7 @@ public class ConservationThread extends AlignCalcWorker { calcMan.notifyStart(this); // updatingConservation = true; - while (!calcMan.notifyWorking(this)) + while ((calcMan != null) && (!calcMan.notifyWorking(this))) { try { @@ -69,12 +69,13 @@ public class ConservationThread extends AlignCalcWorker ex.printStackTrace(); } } - if (alignViewport.isClosed()) + if ((alignViewport == null) || (calcMan == null) + || (alignViewport.isClosed())) { abortAndDestroy(); return; } - List ourAnnot = new ArrayList(); + List ourAnnot = new ArrayList<>(); AlignmentI alignment = alignViewport.getAlignment(); conservation = alignViewport.getAlignmentConservationAnnotation(); quality = alignViewport.getAlignmentQualityAnnot(); @@ -95,7 +96,6 @@ public class ConservationThread extends AlignCalcWorker try { cons = Conservation.calculateConservation("All", - jalview.schemes.ResidueProperties.propHash, 3, alignment.getSequences(), 0, alWidth - 1, false, ConsPercGaps, quality != null); } catch (IndexOutOfBoundsException x) @@ -108,16 +108,22 @@ public class ConservationThread extends AlignCalcWorker } catch (OutOfMemoryError error) { ap.raiseOOMWarning("calculating conservation", error); - calcMan.workerCannotRun(this); + calcMan.disableWorker(this); // alignViewport.conservation = null; // this.alignViewport.quality = null; } calcMan.workerComplete(this); + if ((alignViewport == null) || (calcMan == null) + || (alignViewport.isClosed())) + { + abortAndDestroy(); + return; + } if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } }