jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
changeset 2660 3c98e01dcbcf
parent 2473 3f4bbd3be2f1
parent 2650 44d88464a573
child 2802 d05a9dcc8296
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Apr 28 13:30:42 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Apr 28 13:41:11 2009 -0700
@@ -568,6 +568,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) {