Skip to content

Commit c4f2b31

Browse files
Update window slots w/o holding lock
1 parent 900ebdc commit c4f2b31

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/window/AbstractWindow.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,17 @@ public void handleTick() {
206206

207207
@Override
208208
public void updateSlots() {
209+
BitSet toUpdate;
209210
synchronized (dirtySlots) {
210-
int slot = 0;
211-
while ((slot = dirtySlots.nextSetBit(slot)) != -1) {
212-
update(slot);
213-
slot++;
214-
}
211+
toUpdate = (BitSet) dirtySlots.clone();
215212
dirtySlots.clear();
216213
}
214+
215+
int slot = 0;
216+
while ((slot = toUpdate.nextSetBit(slot)) != -1) {
217+
update(slot);
218+
slot++;
219+
}
217220
}
218221

219222
@Override

0 commit comments

Comments
 (0)