-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 1.4.2, 1.4.2_07
-
None
-
tiger
-
x86
-
windows_nt, windows_2000, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2127614 | 1.4.2_10 | Sean Coffey | P4 | Resolved | Fixed | b01 |
Name: rpR10076 Date: 05/21/2003
Previously similar problem was described in bug
4289940 : (P4/S4) - Can't dispose InputContext while it's active
However, the reliable way to reproduce 4289940 was through
Forte4Java, which contained a bug.
That's why the problem in AWT code wasn't noticed.
However, the simple applet like the one below reproduces the
exception in appletviewer (this was submitted on the jdc some
time ago, thanks for that).
===
public class TestApplet extends java.applet.Applet {
private int dir;
public void start() {
enableEvents(java.awt.AWTEvent.KEY_EVENT_MASK);
}
public void stop() {
disableEvents(java.awt.AWTEvent.KEY_EVENT_MASK);
System.out.println("stop");
}
public void destroy() {
System.out.println("destroy");
}
protected void processEvent(java.awt.AWTEvent e) {
if (e.getID() == java.awt.event.KeyEvent.KEY_TYPED) {
++dir;
repaint();
}
super.processEvent(e);
}
public void paint(java.awt.Graphics g) {
java.awt.Dimension d = getSize();
int n = d.width * (dir & 3) / 3;
g.drawLine(n, 0, d.width - n, d.height);
}
}
===
To reproduce the bug, load this applet in the appletviewer
click on it, press space several times, and try to exit by
closing the appletviewer window. I reproduced it on Windows.
An exception like this will appear:
Exception during disposal:
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:834)
at java.awt.Window.dispose(Window.java:574)
at sun.applet.AppletViewer$3.run(AppletViewer.java:821)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalStateException: Can't dispose InputContext while it's active
at sun.awt.im.InputContext.dispose(InputContext.java:601)
at java.awt.Window$1DisposeAction.run(Window.java:560)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:208)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:143)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:104)
======================================================================
- backported by
-
JDK-2127614 Component.removeNotify() should always deactivate InputContext
-
- Resolved
-
- duplicates
-
JDK-4899557 Can't dispose InputContext while it's active. revisited.
-
- Closed
-
- relates to
-
JDK-4289940 Can't dispose InputContext while it's active
-
- Closed
-