JDK-4072987 : JDK 1.1.2 - Thread AWT-Windows doesn't die when all windows have been closed.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.2,1.1.3,1.1.5,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    solaris_2.6,solaris_7,windows_95,windows_nt solaris_2.6,solaris_7,windows_95,windows_nt
  • CPU: x86,sparc
  • Submitted: 1997-08-19
  • Updated: 2001-02-20
  • Resolved: 2001-02-20
Related Reports
Duplicate :  
Duplicate :  
Description

Name: joT67522			Date: 08/19/97


This occurs on WinNT351 built as a application.

Run the following in jdb. After the two windows open, close 
them. The JVM doesn't shut down even though there is no 
interesting activity happening. A check of the threads shows the 
following;

threads
Group test1.main:
1. <java.awt.EventDispatcher>... AWT-EventQueue-0   cond. waiting
2. <java.lang.Thread>... AWT-Windows   running
3. <sun.awt.ScreenUpdater>... Scrren Updater   cond. waiting

The AWT-Windows thread should close when there are no 
windows left. Either the dispose isn't sending the cleanup
message properly or AWT-Windows just isn't cleaning up. You 
shouldn't have to use System.exit(0) just because you created 
a window. In complex systems this would be tricky.

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

public class test1 extends Object
{
	public static void main(String args[])
	{
		Frame testframe;

		testframe = new Frame("Test1");
		testframe.addWindowListener(new WindowEventDispatcher(testframe));
		testframe.setVisible(true);

		testframe = new Frame("Test2");
		testframe.addWindowListener(new WindowEventDispatcher(testframe));
		testframe.setVisible(true);
	}
}

class WindowEventDispatcher extends WindowAdapter
{
	Frame thetestframe;

	WindowEventDispatcher (Frame atestframe)
	{
		thetestframe = atestframe;
	}

	public void windowClosing(WindowEvent aWindowEvent)
	{
		System.out.println("WindowClosing event");
		thetestframe.setVisible(false);
//		thetestframe.removeWindowListener(this);
		thetestframe.dispose();
		thetestframe = null;
	}
}

company - Banker Trust Australia Limited , email - ###@###.###
======================================================================

Comments
WORK AROUND Name: joT67522 Date: 08/19/97 You would have to track the windows you are opening and either use System.exit(0) or kill the AWT-Windows thread. ======================================================================
11-06-2004

PUBLIC COMMENTS .
10-06-2004

EVALUATION ================================================================ ###@###.### (Dec 5, 1997): Confirmed to be a bug under JDK1.1.2, 1.1.3, 1.1.4, 1.1.5 and 1.2beta2. Platforms on which tests were done: win32 and sol2.6 Not reproduable under Kestrel 1.3 richard.ray@eng 2000-09-14 I can reproduce this in 1.3 using Solaris sparc 2.7 and windows NT4. However, I cannot reproduce it using merlin beta build 52 with either OS. This sounds like a duplicate of 4030718. eric.hawkes@eng 2001-02-19
19-02-2001