synchronizedList must be in a synchronized block when iterating
This commit is contained in:
@@ -67,11 +67,12 @@ public class ItemRepo {
|
||||
|
||||
public IAEItemStack getReferenceItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if (idx >= this.view.size()) {
|
||||
return null;
|
||||
synchronized (this.view) {
|
||||
if (idx >= this.view.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.view.get(idx);
|
||||
}
|
||||
return this.view.get(idx);
|
||||
}
|
||||
|
||||
void setSearch(final String search) {
|
||||
@@ -209,7 +210,9 @@ public class ItemRepo {
|
||||
|
||||
return view;
|
||||
}).thenAcceptAsync(view -> {
|
||||
this.view.clear();
|
||||
synchronized (this.view) {
|
||||
this.view.clear();
|
||||
}
|
||||
this.view.addAll(view);
|
||||
}).thenRunAsync(() -> {
|
||||
this.searchTask = null; // Prevent redundant cancellation
|
||||
|
||||
Reference in New Issue
Block a user