From: gmungoc Date: Thu, 12 Jan 2017 16:44:09 +0000 (+0000) Subject: JAL-2379 null references to PCA model when panel is closed X-Git-Tag: Release_2_10_3b1~375 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4f37b66038b8af85a697e5e4d8945ad9a03fd195;p=jalview.git JAL-2379 null references to PCA model when panel is closed --- diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 4f5a018..aa01bf5 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -46,8 +46,9 @@ import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JColorChooser; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JRadioButtonMenuItem; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; /** * DOCUMENT ME! @@ -81,6 +82,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, */ public PCAPanel(AlignmentPanel ap) { + super(); this.av = ap.av; this.ap = ap; @@ -121,6 +123,16 @@ public class PCAPanel extends GPCAPanel implements Runnable, return; } + + addInternalFrameListener(new InternalFrameAdapter() + { + @Override + public void internalFrameClosed(InternalFrameEvent e) + { + close_actionPerformed(); + } + }); + pcaModel = new PCAModel(seqstrings, seqs, nucleotide); PaintRefresher.Register(this, av.getSequenceSetId()); @@ -130,6 +142,15 @@ public class PCAPanel extends GPCAPanel implements Runnable, worker.start(); } + /** + * Ensure references to potentially very large objects (the PCA matrices) are + * nulled when the frame is closed + */ + protected void close_actionPerformed() + { + pcaModel = null; + } + @Override protected void scoreMatrix_menuSelected() {