EventQueue.java (invokeAndWait): Use list-aware isDispatchThread method to replace...
authorFernando Nasser <fnasser@redhat.com>
Mon, 19 Jan 2004 18:22:29 +0000 (18:22 +0000)
committerFernando Nasser <fnasser@gcc.gnu.org>
Mon, 19 Jan 2004 18:22:29 +0000 (18:22 +0000)
        * java/awt/EventQueue.java (invokeAndWait): Use list-aware
        isDispatchThread method to replace wrong test condition.

From-SVN: r76165

libjava/ChangeLog
libjava/java/awt/EventQueue.java

index 2b34a94..3c779dd 100644 (file)
@@ -1,5 +1,10 @@
 2004-01-19  Fernando Nasser  <fnasser@redhat.com>
 
+       * java/awt/EventQueue.java (invokeAndWait): Use list-aware
+       isDispatchThread method to replace wrong test condition.
+
+2004-01-19  Fernando Nasser  <fnasser@redhat.com>
+
        * java/awt/EventQueue.java (pop): Prevent racing condition to add
        events to the queue out of order by acquiring locks in the proper
        order and not by releasing one before acquiring the other.
index 7df40ed..5cdfa63 100644 (file)
@@ -231,10 +231,11 @@ public class EventQueue
   public static void invokeAndWait(Runnable runnable)
     throws InterruptedException, InvocationTargetException
   {
+    if (isDispatchThread ())
+      throw new Error("Can't call invokeAndWait from event dispatch thread");
+
     EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue(); 
     Thread current = Thread.currentThread();
-    if (current == eq.dispatchThread)
-      throw new Error("Can't call invokeAndWait from event dispatch thread");
 
     InvocationEvent ie = 
       new InvocationEvent(eq, runnable, current, true);