From 364c97f35737e563d27b1681d5e3cefe55bee5b6 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 12 Dec 2021 23:01:53 +0100 Subject: [PATCH] Repair error in halfLink accounting during facet termination --- packages/core/src/runtime/actor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/runtime/actor.ts b/packages/core/src/runtime/actor.ts index bc2b4c8..f459c16 100644 --- a/packages/core/src/runtime/actor.ts +++ b/packages/core/src/runtime/actor.ts @@ -164,7 +164,14 @@ export class Facet { } isInert(): boolean { - return this.children.size === 0 && this.outbound.size === 0 && this.inertCheckPreventers === 0; + const noKids = this.children.size === 0; + const noOutboundHandles = this.outbound.size === 0; + // The only outbound handle the root facet of an actor may have is a link + // assertion, from _halfLink(). This is not to be considered a "real" + // assertion for purposes of keeping the facet alive! + const isRootFacet = this.parent === null; + const noInertCheckPreventers = this.inertCheckPreventers === 0; + return noKids && (noOutboundHandles || isRootFacet) && noInertCheckPreventers; } preventInertCheck(): () => void {