|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
Name: apR10133 Date: 07/24/2003
The Window.dispose() method unconditionally posts WINDOW_CLOSED event,
even if the window is not displayable. If the window disposes its owner
on window closed it will cause the infinite loop of window's dispose and
WINDOW_CLOSED event. I.e. when owner is disposed it calls dispose() for
the owned window, which posts the WINDOW_CLOSED event and the owner is
disposed again...
This bug breaks the fixes for the 4859570 and 4726458.
To reproduce this bug compile and run the test case below
------------------------ test.java -----------------------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class test {
public static void main(String[] argv) {
final JFrame f = new JFrame() {
public void dispose() {
super.dispose();
System.out.println("Dispose owner frame!");
}
};
JWindow w = new JWindow(f);
w.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.out.println("Close window!");
f.dispose();
}
});
w.pack();
w.dispose();
try {
Thread.sleep(3000);
} catch(Exception e) {
}
System.out.println(w.getOwner().isDisplayable());
}
}
----------------------------------------------------------
The output of the test is
Close window!
Dispose owner frame!
Close window!
Dispose owner frame!
Close window!
Dispose owner frame!
...
======================================================================
|