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) {
|
public IAEItemStack getReferenceItem(int idx) {
|
||||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||||
|
synchronized (this.view) {
|
||||||
if (idx >= this.view.size()) {
|
if (idx >= this.view.size()) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
return this.view.get(idx);
|
||||||
}
|
}
|
||||||
return this.view.get(idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSearch(final String search) {
|
void setSearch(final String search) {
|
||||||
@@ -209,7 +210,9 @@ public class ItemRepo {
|
|||||||
|
|
||||||
return view;
|
return view;
|
||||||
}).thenAcceptAsync(view -> {
|
}).thenAcceptAsync(view -> {
|
||||||
this.view.clear();
|
synchronized (this.view) {
|
||||||
|
this.view.clear();
|
||||||
|
}
|
||||||
this.view.addAll(view);
|
this.view.addAll(view);
|
||||||
}).thenRunAsync(() -> {
|
}).thenRunAsync(() -> {
|
||||||
this.searchTask = null; // Prevent redundant cancellation
|
this.searchTask = null; // Prevent redundant cancellation
|
||||||
|
|||||||
Reference in New Issue
Block a user