mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-26 10:01:23 +01:00
Fixed ConfigNode#remove ConcurrentModificationException
This commit is contained in:
parent
c4a0e18dd9
commit
2b4281ee53
@ -126,11 +126,12 @@ public class ConfigNode {
|
|||||||
parent.nodeOrder.remove(key);
|
parent.nodeOrder.remove(key);
|
||||||
updateParent(null);
|
updateParent(null);
|
||||||
|
|
||||||
for (String key : nodeOrder) {
|
// Remove children recursively to avoid memory leaks
|
||||||
ConfigNode child = childNodes.get(key);
|
nodeOrder.stream()
|
||||||
if (child != null) child.remove();
|
.sorted() // will use internal state and prevent Concurrent modification of underlying list
|
||||||
}
|
.map(childNodes::get)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.forEach(ConfigNode::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user