protected Boolean hasChildren = Viewpoint.PENDING_HAS_CHILDREN;
final public void setChildren(PrimitiveQueryUpdater updater, NodeContext[] children) {
+
if (children == null)
throw new NullPointerException(this + ": null children produced by " + getClass().getName());
- for(NodeContext c : children) updater.incRef(c);
- for(NodeContext c : this.children) updater.decRef(c);
+
+ final NodeContext[] currentChildren = this.children;
+
+ updater.execFromQuery(new Runnable() {
+
+ @Override
+ public void run() {
+ for(NodeContext c : children) updater.incRef(c);
+ for(NodeContext c : currentChildren) updater.decRef(c);
+ }
+
+ });
this.children = children;
}