-
Bug
-
Resolution: Fixed
-
P2
-
1.1.7, 1.2.0
-
1.2fcs
-
generic, x86, sparc
-
generic, solaris_2.6, windows_nt
-
Not verified
Because ToolkitEventMulticaster does not override remove(EventListener), the
multicaster chain can be corrupted by inadvertant adds of AWTEventMulticaster
instances, instead of ToolkitEventMulticaster instances.
ToolkitEventMulticaster.remove(AWTEventListener, AWTEventListener)
|
|--> AWTEventMulticaster.removeInternal(EventListener, EventListener)
|
|--> AWTEventMulticaster.remove(EventListener)
|
|--> AWTEventMulticaster.addInternal(EventListener,
| EventListener)
|
|--> creates instance of AWTEventMulticaster and adds
it to multicaster chain.
Then, a subsequent call to TookitEventMulticaster.remove(AWTEventListener,
AWTEventListener) can fail with a ClassCastException. This happens when
we try to cast one of the AWTEventMulticaster instances into an
AWTEventListener. The stack dump looks something like this (the linenumbers
aren't quite right because they're from my internal build):
Exception occurred during event dispatching:
java.lang.ClassCastException: java.awt.AWTEventMulticaster
at java.awt.Toolkit$ToolkitEventMulticaster.remove(Toolkit.java:1571)
at java.awt.Toolkit.removeAWTEventListener(Toolkit.java:1534)
at java.awt.LightweightDispatcher$2.run(Container.java:1847)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.LightweightDispatcher.stopListeningForOtherDrags(Container.j
ava:1844)
at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:179
8)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1705)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1645)
at java.awt.Container.dispatchEventImpl(Container.java:1019)
at java.awt.Window.dispatchEventImpl(Window.java:678)
at java.awt.Component.dispatchEvent(Component.java:2286)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:258)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
The bug seems to happen when dragging in a dialog which is being disposed. See
dpm for a reproducible test case.
Since AWTEventMulticaster.addInternal(EventListener, EventListener) is static,
we can't override it in ToolkitEventMulticaster. Instead, we will need to
override remove(EventListener).
multicaster chain can be corrupted by inadvertant adds of AWTEventMulticaster
instances, instead of ToolkitEventMulticaster instances.
ToolkitEventMulticaster.remove(AWTEventListener, AWTEventListener)
|
|--> AWTEventMulticaster.removeInternal(EventListener, EventListener)
|
|--> AWTEventMulticaster.remove(EventListener)
|
|--> AWTEventMulticaster.addInternal(EventListener,
| EventListener)
|
|--> creates instance of AWTEventMulticaster and adds
it to multicaster chain.
Then, a subsequent call to TookitEventMulticaster.remove(AWTEventListener,
AWTEventListener) can fail with a ClassCastException. This happens when
we try to cast one of the AWTEventMulticaster instances into an
AWTEventListener. The stack dump looks something like this (the linenumbers
aren't quite right because they're from my internal build):
Exception occurred during event dispatching:
java.lang.ClassCastException: java.awt.AWTEventMulticaster
at java.awt.Toolkit$ToolkitEventMulticaster.remove(Toolkit.java:1571)
at java.awt.Toolkit.removeAWTEventListener(Toolkit.java:1534)
at java.awt.LightweightDispatcher$2.run(Container.java:1847)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.LightweightDispatcher.stopListeningForOtherDrags(Container.j
ava:1844)
at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:179
8)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1705)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1645)
at java.awt.Container.dispatchEventImpl(Container.java:1019)
at java.awt.Window.dispatchEventImpl(Window.java:678)
at java.awt.Component.dispatchEvent(Component.java:2286)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:258)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
The bug seems to happen when dragging in a dialog which is being disposed. See
dpm for a reproducible test case.
Since AWTEventMulticaster.addInternal(EventListener, EventListener) is static,
we can't override it in ToolkitEventMulticaster. Instead, we will need to
override remove(EventListener).
- duplicates
-
JDK-4197740 ClassCastException error in JDK 1.2 - JFC
- Closed
-
JDK-4177087 SwingSet JComboBox is throwing java.awt.AWTEventMulticaster exception
- Closed
-
JDK-4178771 SwingSet with JDK-1.2fcs-M occassionally throws java.awt.AWTEventMulticaster
- Closed
- relates to
-
JDK-6264013 Infinite Recursion on EDT causes StackOverflowError
- Resolved
-
JDK-4179773 ClassCastException: AWTEventMulticaster, EventQueue.java, line 251
- Resolved
-
JDK-4201961 Getting exception in java.awt.Toolkit$ToolkitEventMulticaster.remove()
- Closed
(1 relates to)