From 4f37b66038b8af85a697e5e4d8945ad9a03fd195 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 12 Jan 2017 16:44:09 +0000 Subject: [PATCH] JAL-2379 null references to PCA model when panel is closed --- src/jalview/gui/PCAPanel.java | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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() { -- 1.7.10.2