-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6
-
generic
-
windows
Steps to reproduce the problem:
1. Compile the following applet:
import java.awt.event.*;
import java.awt.*;
public class LeakApplet extends Applet {
public void init() {
final Timer t = new Timer(400, new ActionListener() {
JDialog dlg = null;
public void actionPerformed(ActionEvent e) {
if (dlg == null) {
dlg = new Dialog((Frame)null, false);
dlg.setBounds(100, 100, 100, 100);
dlg.setVisible(true);
} else {
dlg.dispose();
dlg = null;
}
} // actionPerformed
}); // Timer class
Button b = new Button("Start");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
t.start();
} // actionPerformed
}); // addActionListener
add(b);
} // init
} // LeakApplet
2. Launch this applet in Mozilla or Mozilla Firefox browser using HTML file:
<html>
<body>
<h2> Test </h2>
<applet code="LeakApplet.class" width="200" height="200"></applet>
</body>
</html>
3. Open another, blank window of the browser (ctrl+N by default). It can be minimized or not.
4. Switch to the first browser window and press 'Start' button in applet.
5. You should see a dialog shown and then hidden periodically. Close the browser window that contains the applet while leaving another blank browser window open or minimized.
6. Sometimes a dialog is left on the screen and it can't be closed any way other than by terminating the whole browser process (that's why another Mozilla window is used).
I don't know if the same problem can be reproduced on linux/solaris or in other browsers. However, I suspect this is a general AWT threading issue.
1. Compile the following applet:
import java.awt.event.*;
import java.awt.*;
public class LeakApplet extends Applet {
public void init() {
final Timer t = new Timer(400, new ActionListener() {
JDialog dlg = null;
public void actionPerformed(ActionEvent e) {
if (dlg == null) {
dlg = new Dialog((Frame)null, false);
dlg.setBounds(100, 100, 100, 100);
dlg.setVisible(true);
} else {
dlg.dispose();
dlg = null;
}
} // actionPerformed
}); // Timer class
Button b = new Button("Start");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
t.start();
} // actionPerformed
}); // addActionListener
add(b);
} // init
} // LeakApplet
2. Launch this applet in Mozilla or Mozilla Firefox browser using HTML file:
<html>
<body>
<h2> Test </h2>
<applet code="LeakApplet.class" width="200" height="200"></applet>
</body>
</html>
3. Open another, blank window of the browser (ctrl+N by default). It can be minimized or not.
4. Switch to the first browser window and press 'Start' button in applet.
5. You should see a dialog shown and then hidden periodically. Close the browser window that contains the applet while leaving another blank browser window open or minimized.
6. Sometimes a dialog is left on the screen and it can't be closed any way other than by terminating the whole browser process (that's why another Mozilla window is used).
I don't know if the same problem can be reproduced on linux/solaris or in other browsers. However, I suspect this is a general AWT threading issue.
- relates to
-
JDK-6553268 AWT text field prevents Java from auto-shutdown, Linux/Solaris
- Closed
-
JDK-6792511 main exists before javax.swing.Timer's start() can start
- Open