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

JDK1.1.3: race condition on awt function dispose

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.3
    • client-libs
    • None
    • x86
    • windows_nt



      Name: rlT66838 Date: 08/07/97


      //
      // Programmname: CloseTwice.java
      // Function: Demonstrates a race condition in the awt libray
      // Language: Java 1.1
      // Author: Dietmar Hechensteiner
      // Email: ###@###.###
      //

      //
      // This program sometimes prints the sentence Dialog closed twice.
      // I am using JDK 1.1.3 on an Compaq Personal Workstation 5000
      // with a dual Pentim Pro 200 Processor Equipment
      // and Windows NT 4.0 Service Pack 3 (US Version)
      // This behavior persists also when i start the Computer in
      // single Processor mode
      // On complex Dialog Boxes the same error causes an exception
      // Behavior verified also on a Pentium 133 Machine under Windows 95
      //

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

      class ActionAdapter implements ActionListener
      {
      public void actionPerformed(ActionEvent e) {}
      }

      class CloseTwice {
      public static void main(String args[]) {
      final Frame fr = new Frame();
      fr.addWindowListener(
      new WindowAdapter() {
      public void
      windowClosed(java.awt.event.WindowEvent e)
      {
      System.out.println("Frame Closed");
      System.exit(0);
      }
      }
              );
      final Dialog d = new Dialog(fr, "Dialog", true);
      d.addWindowListener(
      new WindowAdapter() {
      public void
      windowClosing(java.awt.event.WindowEvent e)
      {
      d.dispose();
      }
      public void
      windowClosed(java.awt.event.WindowEvent e)
      {
      System.out.println("Dialog Closed");
      }
      }
              );
      d.setLayout(new FlowLayout());
      Button btCancel = new Button("Cancel");
      d.add(btCancel);
      btCancel.addActionListener(
      new ActionAdapter() {
      public void actionPerformed(ActionEvent e)
      {
      d.dispose();
      }
      }
              );
      d.setSize(400, 100);
      d.setVisible(true);
      fr.dispose();
      }
      }
      ======================================================================

            rkhansunw Robi Khan (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: