mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 02:02:08 +00:00
[fix] Clean up slot references when removing widgets (#1107)
This commit is contained in:
@@ -1805,6 +1805,16 @@ export class LGraphNode implements NodeLike, Positionable, IPinnable, IColorable
|
|||||||
const widgetIndex = this.widgets.indexOf(widget)
|
const widgetIndex = this.widgets.indexOf(widget)
|
||||||
if (widgetIndex === -1) throw new Error("Widget not found on this node")
|
if (widgetIndex === -1) throw new Error("Widget not found on this node")
|
||||||
|
|
||||||
|
// Clean up slot references to prevent memory leaks
|
||||||
|
if (this.inputs) {
|
||||||
|
for (const input of this.inputs) {
|
||||||
|
if (input._widget === widget) {
|
||||||
|
input._widget = undefined
|
||||||
|
delete input.widget
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.widgets.splice(widgetIndex, 1)
|
this.widgets.splice(widgetIndex, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user