This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] Fix to EventQueue 4/7
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: Fernando Nasser <fnasser at redhat dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 16 Jan 2004 17:55:07 -0500
- Subject: Re: [PATCH] Fix to EventQueue 4/7
- References: <40081DB2.8050900@redhat.com>
On Fri, 2004-01-16 at 12:21, Fernando Nasser wrote:
> If a queue has been pushed we could wrongly return null.
>
> 2004-01-16 Fernando Nasser <fnasser@redhat.com>
>
> * java/awt/EventQueue.java (getCurrentEvent): Consider that system
> events may be handled by any queue in the stack.
Looks good. Thanks,
Tom
________________________________________________________________________
> Index: java/awt/EventQueue.java
> ===================================================================
> RCS file: /cvs/gcc/gcc/libjava/java/awt/EventQueue.java,v
> retrieving revision 1.13
> diff -u -p -r1.13 EventQueue.java
> --- java/awt/EventQueue.java 16 Jan 2004 16:15:49 -0000 1.13
> +++ java/awt/EventQueue.java 16 Jan 2004 17:11:01 -0000
> @@ -293,8 +293,18 @@ public class EventQueue
> public static AWTEvent getCurrentEvent()
> {
> EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
> - if (Thread.currentThread() != eq.dispatchThread)
> - return null;
> + Thread ct = Thread.currentThread();
> +
> + /* Find out if this thread is the dispatch thread for any of the
> + EventQueues in the chain */
> + while (ct != eq.dispatchThread)
> + {
> + // Try next EventQueue, if any
> + if (eq.next == null)
> + return null; // Not an event dispatch thread
> + eq = eq.next;
> + }
> +
> return eq.currentEvent;
> }
>