# HG changeset patch # User Bernhard Urban # Date 1390256433 -7200 # Node ID 8e6b47ee2f25db676ff4be8052c008552ed1f19c # Parent 34b07168b5053db24b14b5bf6b11ad13d81f2744 IGV: throw graph reference away when GraphNode component is closed diff -r 34b07168b505 -r 8e6b47ee2f25 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java Mon Jan 20 20:17:05 2014 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java Tue Jan 21 00:20:33 2014 +0200 @@ -38,6 +38,9 @@ import org.openide.actions.OpenAction; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; +import org.openide.nodes.NodeAdapter; +import org.openide.nodes.NodeEvent; +import org.openide.nodes.NodeMemberEvent; import org.openide.nodes.Sheet; import org.openide.util.ImageUtilities; import org.openide.util.Lookup; @@ -49,7 +52,7 @@ * @author Thomas Wuerthinger */ public class GraphNode extends AbstractNode { - private final InputGraph graph; + private InputGraph graph; /** Creates a new instance of GraphNode */ public GraphNode(InputGraph graph) { @@ -77,6 +80,13 @@ // Action for cloning to the current graph content.add(new GraphCloneCookie(viewer, graph)); + + this.addNodeListener(new NodeAdapter() { + @Override + public void childrenRemoved(NodeMemberEvent ev) { + GraphNode.this.graph = null; + } + }); } @Override