JDK-4683091 : DISPOSE_ON_CLOSE hangs java in windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_98
  • CPU: x86
  • Submitted: 2002-05-10
  • Updated: 2002-05-17
  • Resolved: 2002-05-17
Related Reports
Duplicate :  
Description
When the default close operation is set as DISPOSE_ON_CLOSE in a JFrame, closing the JFrame hangs java. This is seen in build 11 of hopper. The test case given below exits cleanly in build 10. This can be seen from the console output pasted below :

[Z:/work/temp] jdk_1.4.1/b10/binaries/win/bin/java -showversion temp4
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)

Closing the window
[Z:/work/temp] jdk_1.4.1/b11/binaries/win/bin/java -showversion temp4
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b11)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b11, mixed mode)

Closing the window

How to reproduce the problem :
1. Compile and run the source code given.
2. A JFrame appears. Close this frame.
3. Although the frame gets closed, the console does not return to the command prompt as it should.

-----------------BEGIN SOURCE-----------------------
import javax.swing.*;
import java.awt.event.*;
public class test extends JFrame{
        public static void main (String [] args){
                new test();
        }

        public test(){
                super("Test Frame");
                setSize(100,100);
                addWindowListener(new WindowAdapter(){
                        public void windowClosing(WindowEvent we){
                                System.err.println("Closing the window");
                        }
                });
                setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                show();
        }
}
------------------------END SOURCE----------------------

Comments
EVALUATION This does not happen on 2000, only 98, which makes it very unlikely that it is a Swing bug. ###@###.### 2002-05-10 Since this occurs on build 11 of Hopper and not build 10, we will probably need to fix it for hopper-beta. ###@###.### 2002-05-10 It is possible that this is related to 4683602. We should investigate this bug, and find out if they are related. ###@###.### 2002-05-14 Another possibly related bug was just filed, 4685004. The interesting thing about that bug is that it never actually shows any GUI components, but appears to be hanging in AWT shutdown code. The stack trace for that bug doesn't show a deadlock. I've done some investigation of this bug, but haven't come to a conclusion just yet. Unlike the J2DBench bug, I am unable to get a stack trace once the app has hung. There were a couple of suspect changes to awt_Toolkit.cpp that went into b11, namely 4623377 and 4646627. I backed those fixes out individually, but that did not avoid the hang. Running w/ java_g and/or -Xint also made no difference. ###@###.### 2002-05-14
14-05-2002