You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/09/09 17:33:32 UTC

svn commit: r812997 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Author: gbrown
Date: Wed Sep  9 15:33:31 2009
New Revision: 812997

URL: http://svn.apache.org/viewvc?rev=812997&view=rev
Log:
Add workaround for Safari timer issue.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=812997&r1=812996&r2=812997&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Wed Sep  9 15:33:31 2009
@@ -1491,7 +1491,18 @@
      */
     public static ScheduledCallback scheduleCallback(Runnable callback, long delay) {
         ScheduledCallback scheduledCallback = new ScheduledCallback(callback);
-        timer.schedule(scheduledCallback, delay);
+
+        // TODO This is a workaround for a potential OS X bug; revisit
+        try {
+            try {
+                timer.schedule(scheduledCallback, delay);
+            } catch (IllegalStateException exception) {
+                createTimer();
+                timer.schedule(scheduledCallback, delay);
+            }
+        } catch (Throwable throwable) {
+            System.err.println("Unable to schedule callback: " + throwable);
+        }
 
         return scheduledCallback;
     }
@@ -1525,7 +1536,18 @@
      */
     public static ScheduledCallback scheduleRecurringCallback(Runnable callback, long delay, long period) {
         ScheduledCallback scheduledCallback = new ScheduledCallback(callback);
-        timer.schedule(scheduledCallback, delay, period);
+
+        // TODO This is a workaround for a potential OS X bug; revisit
+        try {
+            try {
+                timer.schedule(scheduledCallback, delay, period);
+            } catch (IllegalStateException exception) {
+                createTimer();
+                timer.schedule(scheduledCallback, delay, period);
+            }
+        } catch (Throwable throwable) {
+            System.err.println("Unable to schedule callback: " + throwable);
+        }
 
         return scheduledCallback;
     }