Fixed seemingly random server crashes caused by ArrayIndexOutOfBoundsException on unsafe type during threaded operations by synchronizing add/remove logic for PulseRunner.TASKS

This commit is contained in:
vddcore
2022-07-03 07:20:24 +00:00
committed by Ryan
parent 350a2964ce
commit 2846ff7172
2 changed files with 7 additions and 2 deletions
@@ -10,9 +10,12 @@ import java.util.*
class PulseRunner { class PulseRunner {
val TASKS = ArrayList<Pulse>() val TASKS = ArrayList<Pulse>()
fun submit(pulse: Pulse){ fun submit(pulse: Pulse){
synchronized(this.TASKS) {
TASKS.add(pulse) TASKS.add(pulse)
} }
}
} }
/* /*
class PulseeRunner { class PulseeRunner {
@@ -106,8 +106,10 @@ class MajorUpdateWorker {
//remove all null or finished pulses from the list //remove all null or finished pulses from the list
rmlist.forEach { rmlist.forEach {
synchronized(GameWorld.Pulser.TASKS) {
GameWorld.Pulser.TASKS.remove(it) GameWorld.Pulser.TASKS.remove(it)
} }
}
rmlist.clear() rmlist.clear()
//perform our update sequence where we write masks, etc //perform our update sequence where we write masks, etc