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

REGRESSION: stacked modal dialogs freeze the System

XMLWordPrintable

    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.5.0_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
      Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      full updated

      A DESCRIPTION OF THE PROBLEM :
      Our comlex application stacked modal dialogs on top of each other. In some cases the system hangs with the latest jre.
      Last system without the effect was 1.5.0_02

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * Start the test case
      * press "go on"
      * press "go on"
      * press "go on"
      * press "OK"

      Now the application hangs.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "Dialog2" is on top an usable
      ACTUAL -
      "Frame1" is focused and no input is possible

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.*;
      import javax.swing.*;

      class ModalTest extends JFrame {
        
        public static void main(String[] args) {
          try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable ex) { }
          new ModalTest().setVisible(true);
        }

        ModalTest() {
          super("Frame1");
          this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
            }
          });
          JButton btn1 = new JButton();
          btn1.setText("go on");
          btn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
              Dialog1 dlg = new Dialog1();
              dlg.initFields();
              dlg.setVisible(true);
            }
          });
          this.getContentPane().add(btn1);
          pack();
        }

        class Dialog1 extends JDialog {

          private JDialog dlg2;
          
          Dialog1() {
            super(ModalTest.this, "Dialog1", true);
            JButton btn1 = new JButton();
            btn1.setText("go on");
            btn1.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(ActionEvent e) {
                dlg2.setVisible(true);
              }
            });
            getContentPane().add(btn1);
            pack();
            this.setLocation(50, 20);
          }

          void initFields() {
            dlg2 = new Dialog2();
          }
        }

        class Dialog2 extends JDialog {

          Dialog2() {
            super(ModalTest.this, "Dialog2", true);
            JButton btn1 = new JButton();
            btn1.setText("go on");
            btn1.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                btn1_actionPerformed();
              }
            });
            getContentPane().add(btn1);
            pack();
            this.setLocation(80, 40);
          }

          private void btn1_actionPerformed() {
            JOptionPane.showMessageDialog(ModalTest.this, "last message before system hangs", "JOptionPane", JOptionPane.WARNING_MESSAGE);
          }
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      use jre1.5.0_02 or create dlg2 later

      Release Regression From : 5.0u2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-05-26 09:14:30 GMT

            robm Robert Mckenna
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: