[backport 1.25] fix: Add guards for _listenerController.abort() calls in SubgraphNode (#4970)

Backport of #4968 to `core/1.25`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-4970-backport-1-25-fix-Add-guards-for-_listenerController-abort-calls-in-SubgraphNode-24e6d73d365081838ca0c1d0a1734ba0)
by [Unito](https://www.unito.io)

Co-authored-by: Christian Byrne <cbyrne@comfy.org>
This commit is contained in:
Comfy Org PR Bot
2025-08-14 06:59:44 +08:00
committed by GitHub
parent a9c80e91d3
commit f6967d889e

View File

@@ -171,7 +171,12 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
subgraphInput: SubgraphInput,
input: INodeInputSlot & Partial<ISubgraphInput>
) {
input._listenerController?.abort()
if (
input._listenerController &&
typeof input._listenerController.abort === 'function'
) {
input._listenerController.abort()
}
input._listenerController = new AbortController()
const { signal } = input._listenerController
@@ -207,7 +212,12 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
override configure(info: ExportedSubgraphInstance): void {
for (const input of this.inputs) {
input._listenerController?.abort()
if (
input._listenerController &&
typeof input._listenerController.abort === 'function'
) {
input._listenerController.abort()
}
}
this.inputs.length = 0
@@ -518,7 +528,12 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
}
for (const input of this.inputs) {
input._listenerController?.abort()
if (
input._listenerController &&
typeof input._listenerController.abort === 'function'
) {
input._listenerController.abort()
}
}
}
}