Hi,

While debugging some other swing issue we found an small issue with
Timer.Waker ending prematurely if sleep() would be spuriously
interrupted. This makes sure the Waker only terminates when really
requested by Timer.stop().

2005-11-02  Mark Wielaard  <[EMAIL PROTECTED]>

    * javax/swing/Timer.java (Waker.run): Only break out when !running.

Committed,

Mark
Index: javax/swing/Timer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/Timer.java,v
retrieving revision 1.21
diff -u -r1.21 Timer.java
--- javax/swing/Timer.java	16 Sep 2005 18:44:56 -0000	1.21
+++ javax/swing/Timer.java	2 Nov 2005 21:29:46 -0000
@@ -68,7 +68,15 @@
       running = true;
       try
         {
-          sleep(initialDelay);
+          try
+            {
+              sleep(initialDelay);
+            }
+          catch (InterruptedException e)
+            {
+              if (!running)
+                return;
+            }
 
           queueEvent();
 
@@ -81,7 +89,8 @@
                   }
                 catch (InterruptedException e)
                   {
-                    return;
+                    if (!running)
+                      break;
                   }
                 queueEvent();
 
@@ -93,7 +102,7 @@
               }
           running = false;
         }
-      catch (Exception e)
+      finally
         {
           // The timer is no longer running.
           running = false;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to