8024839: [Unified Swing/Fx threading] don't schedule an event dispatching from the event dispatch thread
authorant
Wed, 18 Sep 2013 12:25:13 +0400
changeset 20142 43a46d7366ab
parent 20141 2ed60881f2a1
child 20143 c8d62571d319
8024839: [Unified Swing/Fx threading] don't schedule an event dispatching from the event dispatch thread Reviewed-by: anthony, pchelko
jdk/src/share/classes/java/awt/EventQueue.java
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Mon Sep 16 15:43:06 2013 -0400
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Wed Sep 18 12:25:13 2013 +0400
@@ -690,7 +690,10 @@
         final Object src = event.getSource();
         final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
             public Void run() {
-                if (fwDispatcher == null) {
+                // In case fwDispatcher is installed and we're already on the
+                // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage),
+                // dispatch the event straight away.
+                if (fwDispatcher == null || isDispatchThreadImpl()) {
                     dispatchEventImpl(event, src);
                 } else {
                     fwDispatcher.scheduleDispatch(new Runnable() {