forked from 2009Scape/Server
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:
parent
350a2964ce
commit
2846ff7172
2 changed files with 7 additions and 2 deletions
|
|
@ -10,8 +10,11 @@ import java.util.*
|
|||
|
||||
class PulseRunner {
|
||||
val TASKS = ArrayList<Pulse>()
|
||||
|
||||
fun submit(pulse: Pulse){
|
||||
TASKS.add(pulse)
|
||||
synchronized(this.TASKS) {
|
||||
TASKS.add(pulse)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -106,7 +106,9 @@ class MajorUpdateWorker {
|
|||
|
||||
//remove all null or finished pulses from the list
|
||||
rmlist.forEach {
|
||||
GameWorld.Pulser.TASKS.remove(it)
|
||||
synchronized(GameWorld.Pulser.TASKS) {
|
||||
GameWorld.Pulser.TASKS.remove(it)
|
||||
}
|
||||
}
|
||||
|
||||
rmlist.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue