prevent concurrent modification
This commit is contained in:
@@ -72,11 +72,11 @@ public class Window implements Closeable {
|
||||
this.regularTasks = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addRegularTask(Consumer<Float> task) {
|
||||
public synchronized void addRegularTask(Consumer<Float> task) {
|
||||
this.regularTasks.add(task);
|
||||
}
|
||||
|
||||
public void removeRegularTask(Consumer<Float> task) {this.regularTasks.remove(task);}
|
||||
public synchronized void removeRegularTask(Consumer<Float> task) {this.regularTasks.remove(task);}
|
||||
|
||||
public synchronized void scheduleTask(Runnable runnable) {
|
||||
this.tasks.add(runnable);
|
||||
@@ -195,7 +195,7 @@ public class Window implements Closeable {
|
||||
}
|
||||
}
|
||||
|
||||
private void executeTasks(float delta) {
|
||||
private synchronized void executeTasks(float delta) {
|
||||
Runnable task = getNextTask();
|
||||
while (task != null) {
|
||||
task.run();
|
||||
|
||||
Reference in New Issue
Block a user