mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 13:42:59 +00:00 
			
		
		
		
	Merge pull request #2189 from Fox2Code/1.4.7-concurrent-fix
Fix ConcurrentModificationException caused by timers
This commit is contained in:
		| @@ -203,9 +203,11 @@ public class OSAPI implements ILuaAPI { | ||||
|      */ | ||||
|     @LuaFunction | ||||
|     public final int startTimer(double timer) throws LuaException { | ||||
|         synchronized (timers) { | ||||
|             timers.put(nextTimerToken, new Timer((int) Math.round(checkFinite(0, timer) / 0.05))); | ||||
|             return nextTimerToken++; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Cancels a timer previously started with startTimer. This will stop the | ||||
| @@ -217,8 +219,10 @@ public class OSAPI implements ILuaAPI { | ||||
|      */ | ||||
|     @LuaFunction | ||||
|     public final void cancelTimer(int token) { | ||||
|         synchronized (timers) { | ||||
|             timers.remove(token); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Sets an alarm that will fire at the specified in-game time. When it | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates