diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java index e7ed553b70f60e6c3e5230daf1fe48174e6d61b6..2e89f81f2cc2f6935cf32ae8f443fb39f875c702 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java @@ -79,12 +79,12 @@ public class BrowserFunctions { @Specialization protected RNull browser(VirtualFrame frame, Object text, RNull condition, boolean expr, int skipCalls) { if (expr) { - RContext instance = RContext.getInstance(); - if (instance.getKind() == ContextKind.SHARE_NOTHING) { + RContext curContext = RContext.getInstance(); + if (!curContext.isInitial() && curContext.getKind() == ContextKind.SHARE_ALL && curContext.getParent().getKind() == ContextKind.SHARE_NOTHING) { return RNull.instance; } - BrowserState browserState = instance.stateInstrumentation.getBrowserState(); + BrowserState browserState = curContext.stateInstrumentation.getBrowserState(); try { browserState.push(new HelperState(text, condition)); MaterializedFrame mFrame = frame.materialize(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java index e5878a1aa39a0c382e10af83b349bf45c258608a..ae9ee8956e789754f9b6b11db86b3958d1311cea 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java @@ -598,6 +598,8 @@ public final class RContext implements RTruffleObject { } state = EnumSet.of(State.DISPOSED); + assert !initial || EvalThread.threadCnt.get() == 0 : "Did not close all children contexts"; + this.allocationReporter.removePropertyChangeListener(ALLOCATION_ACTIVATION_LISTENER); } }