-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.8
-
sparc
-
solaris_2.6
This is a bug on Solaris under JDK 1.1.8 only.
If a visible non-modal Dialog is made modal via Dialog.setModal(true), the AWT EventQueue thread hangs (see thread dump below). If a Dialog is visible, calling Dialog.setModal(boolean) should have no effect.
//---------------------------ModalTest.java-----------------------------
// (1) Run the test case, and a Frame comes up.
// (2) Click on the "test" button and a Dialog, initially non-modal, pops up.
// (3) Click on the "test" button again, making the Dialog modal. The
// AWT is now hung.
import java.awt.*;
import java.awt.event.*;
public class ModalTest extends Frame implements ActionListener
{
boolean modal = false;
TestDialog testDialog;
public static void main(String argv[])
{
ModalTest Test = new ModalTest();
}
public ModalTest()
{
setSize (200,200);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
Button button = new Button("test");
button.addActionListener(this);
button.setSize(10,5);
add(button);
setVisible(true);
testDialog = new TestDialog(this);
}
public void actionPerformed(ActionEvent e)
{
testDialog.setModal(modal);
System.out.println("modal setting is now = " + modal);
modal = !modal;
testDialog.setVisible(true);
}
public class TestDialog extends Dialog implements ActionListener
{
protected Button okButton;
public TestDialog(Frame parent)
{
super(parent);
okButton = new Button("OK");
okButton.addActionListener(this);
add(okButton);
setLocation(400,400);
setSize(100,100);
}
public void actionPerformed(ActionEvent e)
{
setVisible(false);
}
}
}
^\SIGQUIT 3* quit
Full thread dump:
"Screen Updater" (TID:0xee306de8, sys_thread_t:0xef0c1db8, state:CW) prio=4
java.lang.Object.wait(Object.java)
sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:70)
sun.awt.ScreenUpdater.run(ScreenUpdater.java:90)
"AWT-Motif" (TID:0xee305288, sys_thread_t:0xef0f1db8, state:CW) prio=5
java.lang.Thread.run(Thread.java)
"AWT-Input" (TID:0xee304fe8, sys_thread_t:0xef121db8, state:CW) prio=5
"AWT-EventQueue-0" (TID:0xee305000, sys_thread_t:0xef151db8, state:CW) prio=5
sun.awt.motif.MDialogPeer.toFront(MDialogPeer.java:111)
java.awt.Window.toFront(Window.java:204)
java.awt.Dialog.show(Dialog.java:202)
java.awt.Component.show(Component.java:511)
java.awt.Component.setVisible(Component.java:473)
ModalTest.actionPerformed(ModalTest.java:46)
java.awt.Button.processActionEvent(Button.java:256)
java.awt.Button.processEvent(Button.java:229)
java.awt.Component.dispatchEventImpl(Component.java:1812)
java.awt.Component.dispatchEvent(Component.java:1744)
java.awt.EventDispatchThread.run(EventDispatchThread.java:79)
"Finalizer thread" (TID:0xee300210, sys_thread_t:0xef341db8, state:CW) prio=1
"Async Garbage Collector" (TID:0xee300258, sys_thread_t:0xef371db8, state:CW) prio=1
"Idle thread" (TID:0xee3002a0, sys_thread_t:0xef471db8, state:R) prio=0 *current thread*
"Clock" (TID:0xee300088, sys_thread_t:0xef561db8, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x43908, state:CW) prio=5
Monitor Cache Dump:
sun.awt.ScreenUpdater@EE306DE8/EE35ADB8: <unowned>
Waiting to be notified:
"Screen Updater" (0xef0c1db8)
sun.awt.motif.MToolkit@EE305088/EE353A80: <unowned>
Waiting to be notified:
"AWT-EventQueue-0" (0xef151db8)
"AWT-Motif" (0xef0f1db8)
<unknown key> (0xef371db8): <unowned>
Waiting to be notified:
"Async Garbage Collector" (0xef371db8)
Registered Monitor Dump:
Thread queue lock: <unowned>
Waiting to be notified:
"main" (0x43908)
Name and type hash table lock: <unowned>
String intern lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Has finalization queue lock: <unowned>
Finalize me queue lock: <unowned>
Waiting to be notified:
"Finalizer thread" (0xef341db8)
Dynamic loading lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Waiting to be notified:
"AWT-Input" (0xef121db8)
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xef561db8)
Sbrk lock: <unowned>
Monitor registry: owner "Idle thread" (0xef471db8, 1 entry)
Thread Alarm Q:
sys_thread_t 0xef121db8 [Timeout in 118 ms]
sys_thread_t 0xef371db8 [Timeout in 729 ms]
If a visible non-modal Dialog is made modal via Dialog.setModal(true), the AWT EventQueue thread hangs (see thread dump below). If a Dialog is visible, calling Dialog.setModal(boolean) should have no effect.
//---------------------------ModalTest.java-----------------------------
// (1) Run the test case, and a Frame comes up.
// (2) Click on the "test" button and a Dialog, initially non-modal, pops up.
// (3) Click on the "test" button again, making the Dialog modal. The
// AWT is now hung.
import java.awt.*;
import java.awt.event.*;
public class ModalTest extends Frame implements ActionListener
{
boolean modal = false;
TestDialog testDialog;
public static void main(String argv[])
{
ModalTest Test = new ModalTest();
}
public ModalTest()
{
setSize (200,200);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
Button button = new Button("test");
button.addActionListener(this);
button.setSize(10,5);
add(button);
setVisible(true);
testDialog = new TestDialog(this);
}
public void actionPerformed(ActionEvent e)
{
testDialog.setModal(modal);
System.out.println("modal setting is now = " + modal);
modal = !modal;
testDialog.setVisible(true);
}
public class TestDialog extends Dialog implements ActionListener
{
protected Button okButton;
public TestDialog(Frame parent)
{
super(parent);
okButton = new Button("OK");
okButton.addActionListener(this);
add(okButton);
setLocation(400,400);
setSize(100,100);
}
public void actionPerformed(ActionEvent e)
{
setVisible(false);
}
}
}
^\SIGQUIT 3* quit
Full thread dump:
"Screen Updater" (TID:0xee306de8, sys_thread_t:0xef0c1db8, state:CW) prio=4
java.lang.Object.wait(Object.java)
sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:70)
sun.awt.ScreenUpdater.run(ScreenUpdater.java:90)
"AWT-Motif" (TID:0xee305288, sys_thread_t:0xef0f1db8, state:CW) prio=5
java.lang.Thread.run(Thread.java)
"AWT-Input" (TID:0xee304fe8, sys_thread_t:0xef121db8, state:CW) prio=5
"AWT-EventQueue-0" (TID:0xee305000, sys_thread_t:0xef151db8, state:CW) prio=5
sun.awt.motif.MDialogPeer.toFront(MDialogPeer.java:111)
java.awt.Window.toFront(Window.java:204)
java.awt.Dialog.show(Dialog.java:202)
java.awt.Component.show(Component.java:511)
java.awt.Component.setVisible(Component.java:473)
ModalTest.actionPerformed(ModalTest.java:46)
java.awt.Button.processActionEvent(Button.java:256)
java.awt.Button.processEvent(Button.java:229)
java.awt.Component.dispatchEventImpl(Component.java:1812)
java.awt.Component.dispatchEvent(Component.java:1744)
java.awt.EventDispatchThread.run(EventDispatchThread.java:79)
"Finalizer thread" (TID:0xee300210, sys_thread_t:0xef341db8, state:CW) prio=1
"Async Garbage Collector" (TID:0xee300258, sys_thread_t:0xef371db8, state:CW) prio=1
"Idle thread" (TID:0xee3002a0, sys_thread_t:0xef471db8, state:R) prio=0 *current thread*
"Clock" (TID:0xee300088, sys_thread_t:0xef561db8, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x43908, state:CW) prio=5
Monitor Cache Dump:
sun.awt.ScreenUpdater@EE306DE8/EE35ADB8: <unowned>
Waiting to be notified:
"Screen Updater" (0xef0c1db8)
sun.awt.motif.MToolkit@EE305088/EE353A80: <unowned>
Waiting to be notified:
"AWT-EventQueue-0" (0xef151db8)
"AWT-Motif" (0xef0f1db8)
<unknown key> (0xef371db8): <unowned>
Waiting to be notified:
"Async Garbage Collector" (0xef371db8)
Registered Monitor Dump:
Thread queue lock: <unowned>
Waiting to be notified:
"main" (0x43908)
Name and type hash table lock: <unowned>
String intern lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Has finalization queue lock: <unowned>
Finalize me queue lock: <unowned>
Waiting to be notified:
"Finalizer thread" (0xef341db8)
Dynamic loading lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Waiting to be notified:
"AWT-Input" (0xef121db8)
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xef561db8)
Sbrk lock: <unowned>
Monitor registry: owner "Idle thread" (0xef471db8, 1 entry)
Thread Alarm Q:
sys_thread_t 0xef121db8 [Timeout in 118 ms]
sys_thread_t 0xef371db8 [Timeout in 729 ms]