You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/05/30 09:48:46 UTC

svn commit: r1129031 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java

Author: noelgrandin
Date: Mon May 30 07:48:46 2011
New Revision: 1129031

URL: http://svn.apache.org/viewvc?rev=1129031&view=rev
Log:
PIVOT-747 pivot & blocking edt

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=1129031&r1=1129030&r2=1129031&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Mon May 30 07:48:46 2011
@@ -845,11 +845,21 @@ public abstract class Container extends 
     }
 
     public static final void assertEventDispatchThread() {
+        String threadName = Thread.currentThread().getName();
         /* Currently, application startup happens on the main thread, so we need to allow
          * that thread to modify WTK state.
          */
-        if (!java.awt.EventQueue.isDispatchThread()
-             && !Thread.currentThread().getName().equals("main")) {
+        if (threadName.equals("main")) {
+            return;
+        }
+        /*
+         * See Sun/Oracle bug 6424157. There is a race condition where we can be running on the event thread
+         * but isDispatchThread() will return false.
+         */
+        if (threadName.startsWith("AWT-EventQueue-")) {
+            return;
+        }
+        if (!java.awt.EventQueue.isDispatchThread()) {
             throw new IllegalStateException("this method can only be called from the AWT event dispatch thread");
         }
     }