From a7168a947828a74899fff98c5f4f59515f60432a Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 12 Nov 2010 14:59:48 +0000 Subject: [PATCH] patch for JAL-699 so conservation/consensus threads restart correctly --- src/jalview/appletgui/AlignViewport.java | 8 ++++++-- src/jalview/gui/AlignViewport.java | 6 ++++-- src/jalview/gui/ConservationThread.java | 8 +++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 804b590..6d6a3e6 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -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; } diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 6f713fc..ef7d35c 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -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; } diff --git a/src/jalview/gui/ConservationThread.java b/src/jalview/gui/ConservationThread.java index fa70bcc..5ed536c 100644 --- a/src/jalview/gui/ConservationThread.java +++ b/src/jalview/gui/ConservationThread.java @@ -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; -- 1.7.10.2