changeset 1165:7601454859c2

6829923: Test javax/swing/system/6799345/TestShutdown.java fails on X11 platforms Summary: XAWT toolkit thread is correctly interrupted when AppContext is disposed Reviewed-by: anthony, peterz
author art
date Fri, 17 Apr 2009 12:46:24 +0400
parents 1729e34a0287
children 8e01a3dee336
files src/solaris/classes/sun/awt/X11/XToolkit.java
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Apr 10 11:51:36 2009 +0900
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Apr 17 12:46:24 2009 +0400
@@ -565,6 +565,17 @@
     {
         XEvent ev = new XEvent();
         while(true) {
+            // Fix for 6829923: we should gracefully handle toolkit thread interruption
+            if (Thread.currentThread().isInterrupted()) {
+                // We expect interruption from the AppContext.dispose() method only.
+                // If the thread is interrupted from another place, let's skip it
+                // for compatibility reasons. Probably some time later we'll remove
+                // the check for AppContext.isDisposed() and will unconditionally
+                // break the loop here.
+                if (AppContext.getAppContext().isDisposed()) {
+                    break;
+                }
+            }
             awtLock();
             try {
                 if (loop == SECONDARY_LOOP) {