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

Modal dialog blocks calling thread after it is hidden and disposed

    XMLWordPrintable

Details

    • b55
    • generic
    • generic
    • Verified

    Description

      Sometimes it's possible that modal dialog still blocks the calling thread (the thread it was shown on) even after it's been disposed. Here is the short testcase that demonstrates the problem:

      import java.awt.*;
      import java.awt.event.*;

      public class TestModalDialog {
          public static void main(String[] args) {
              Frame f = new Frame();
              f.setSize(400, 300);
              f.setVisible(true);
              final Dialog d = new Dialog(f);
              Button b = new Button("Test");
              d.add(b);
              b.addActionListener(new ActionListener() {
                      public void actionPerformed(ActionEvent ev) {
                          d.setVisible(false);
                          d.dispose();
                      }
                  });
              d.setSize(200, 100);
              d.setModal(true);
              d.setVisible(true);
              System.err.println("dialog closed");
              f.dispose();
          }
      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: