aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2004-01-13 22:51:26 +0000
committerFernando Nasser <fnasser@gcc.gnu.org>2004-01-13 22:51:26 +0000
commit25c3f7c8b94b62cc83adf1c24bb323ff1c46416b (patch)
tree19d5d70344d911775cbe074ab49d8a1022a329f7 /libjava/java
parentd4f3ce5cc08a8c76a2ceb8e88432e80b94beca27 (diff)
downloadgcc-25c3f7c8b94b62cc83adf1c24bb323ff1c46416b.zip
gcc-25c3f7c8b94b62cc83adf1c24bb323ff1c46416b.tar.gz
gcc-25c3f7c8b94b62cc83adf1c24bb323ff1c46416b.tar.bz2
* java/awt/EventQueue.java (isDispatchThread): Do check on top of stack. (push): Make sure push is performed at the top of the thread stack.
From-SVN: r75820
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/awt/EventQueue.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
index 45dc971..d20edbc 100644
--- a/libjava/java/awt/EventQueue.java
+++ b/libjava/java/awt/EventQueue.java
@@ -269,12 +269,17 @@ public class EventQueue
}
/**
- * Return true if the current thread is the AWT event dispatch
+ * Return true if the current thread is the current AWT event dispatch
* thread.
*/
public static boolean isDispatchThread()
{
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+
+ /* Find last EventQueue in chain */
+ while (eq.next != null)
+ eq = eq.next;
+
return (Thread.currentThread() == eq.dispatchThread);
}
@@ -306,6 +311,15 @@ public class EventQueue
if (newEventQueue == null)
throw new NullPointerException ();
+ /* Make sure we are at the top of the stack because callers can
+ only get a reference to the one at the bottom using
+ Toolkit.getDefaultToolkit().getSystemEventQueue() */
+ if (next != null)
+ {
+ next.push (newEventQueue);
+ return;
+ }
+
int i = next_out;
while (i != next_in)
{