JDK-4850815 : Swing does not stop painter thread
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-04-18
  • Updated: 2003-04-18
  • Resolved: 2003-04-18
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 04/18/2003


FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
In your comment to Bug Report no. 4843790 you wrote:

In 1.4 AWT added code such that the Event Dispatching Thread would stop in
certain cases, thereby allowing the app to exit.
The test case does not trigger this as it does not dispose of the window that
it creates. If you add:
                jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
It will.

Unfortunately that does NOT close the application - still AWT keeps running and such the java.exe does not terminate. This leads to the problems described in 4843790.

REGRESSION.  Last worked in version mantis-beta

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import javax.swing.JDialog;
public class SwingTest {
	public static void main(String[] args) {
		final JDialog d = new JDialog();
		d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		d.show();
	}
}

Compile this.
Go to the command line on W2K: cmd.exe
type java.exe SwingTest and press return
You'll se that a tiny dialog opens.
Click the close button of the dialog.
The dialog closes.

EXPECTED VERSUS ACTUAL BEHAVIOR :
java.exe should terminate, so that I can type in the next command into the command line now.
java.exe does not terminate.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.JDialog;
public class SwingTest {
	public static void main(String[] args) {
		final JDialog d = new JDialog();
		d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		d.show();
	}
}

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

CUSTOMER SUBMITTED WORKAROUND :
d.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);

what leads to the whole VM stopping, even if there are other swing threads running OR write a launcher software that listens for any terminating swing program by a proprietary mechanism and System.exit() when all swing apps are closed.
(Review ID: 183797) 
======================================================================

Comments
EVALUATION 4843790's test case had a JFrame, which if setDefaultCloseOperation(DISPOSE_ON_CLOSE) is set on it will cause the vm to exit. The test case in this bug uses a JDialog, which is different. This is a known problem with JDialog's null constructor and is already filed. Refer to 4726458 for the details. ###@###.### 2003-04-18
18-04-2003