Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6407552

AWT/plugin is not terminated if a window is periodically shown from Timer

XMLWordPrintable

    • 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.

            dtitov Daniil Titov (Inactive)
            art Artem Ananiev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: