-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
03
-
x86
-
windows_nt
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2038591 | 1.4.0 | Scott Violet | P3 | Resolved | Fixed | beta |
Name: yyT116575 Date: 11/14/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
The attached program includes a JMenuBar with a JMenu in it. Clicking on
the "Remove" button should cause the JMenuBar and the JMenu to become garbage.
The JMenuBar does become garbage, but the JMenu does not. I do not have any
poitners to it, they're all from JDK (BasicMenuUI$PostAction,
BasicMenuUI$ChangeHandler, SwingPropertyChangeSupport, etc).
--- code ---
import javax.swing.*;
import java.awt.event.*;
class Test {
JFrame f;
JMenuBar mb;
JMenu menu;
Test () {
f = new JFrame("TEST");
mb = new JMenuBar();
menu = new JMenu("Test Menu");
mb.add(menu);
f.setJMenuBar(mb);
JButton b = new JButton("Remove");
f.getContentPane().add(b);
b.addActionListener(new ActionListener () {
public void actionPerformed (ActionEvent e) {
disposeMenu();
}
});
f.pack();
f.show();
}
private void disposeMenu () {
f.setJMenuBar(null);
mb.remove(menu);
menu = null;
mb = null;
f.validate();
}
public static void main (String[] args) {
new Test();
}
}
(Review ID: 112246)
======================================================================
- backported by
-
JDK-2038591 JMenu memory leak
- Resolved