JAL-3108 fix concurrency bug in Reveal action handler
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 10 Sep 2018 09:34:21 +0000 (10:34 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 10 Sep 2018 09:34:21 +0000 (10:34 +0100)
src/jalview/gui/ScalePanel.java

index e6bba02..5601c7a 100755 (executable)
@@ -158,7 +158,12 @@ public class ScalePanel extends JPanel
   protected void rightMouseButtonPressed(MouseEvent evt, final int res)
   {
     JPopupMenu pop = new JPopupMenu();
-    if (reveal != null)
+
+    /*
+     * grab the hidden range in case mouseMoved nulls it
+     */
+    final int[] hiddenRange = reveal;
+    if (hiddenRange != null)
     {
       JMenuItem item = new JMenuItem(
               MessageManager.getString("label.reveal"));
@@ -167,7 +172,7 @@ public class ScalePanel extends JPanel
         @Override
         public void actionPerformed(ActionEvent e)
         {
-          av.showColumn(reveal[0]);
+          av.showColumn(hiddenRange[0]);
           reveal = null;
           ap.paintAlignment(true, true);
           av.sendSelection();