X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.common%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcommon%2Fviewpoints%2FViewpointStub.java;h=b33b57a0b720df1b5a20f5b0aefcd1c57260afb0;hb=68ce0966a57f5153b133c6283fdbae10f683b745;hp=4895d3f75425ed00df79a8703c7656a41e52c18a;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java index 4895d3f75..b33b57a0b 100644 --- a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java +++ b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/viewpoints/ViewpointStub.java @@ -29,10 +29,21 @@ public abstract class ViewpointStub implements Viewpoint { 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; }