Fixed #391 - NodeGrid concurrent modification

This commit is contained in:
Calclavia 2014-03-07 21:58:36 -08:00
parent 53f833b094
commit 2771f34350

View file

@ -26,10 +26,14 @@ public abstract class NodeGrid<N extends Node> extends Grid<N>
if (isValidNode(connection) && connection instanceof Node)
{
Node connectedNode = (Node) connection;
if (connectedNode.getGrid() != this)
{
connectedNode.getGrid().getNodes().clear();
synchronized (connectedNode.getGrid().getNodes())
{
connectedNode.getGrid().getNodes().clear();
}
add((N) connectedNode);
reconstructNode((N) connectedNode);
}