mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-01 22:09:55 +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)
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user