Skip to content

Commit 3db4470

Browse files
[fix] Clean up slot references when removing widgets (#1107)
1 parent 2b831d5 commit 3db4470

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/LGraphNode.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,16 @@ export class LGraphNode implements NodeLike, Positionable, IPinnable, IColorable
18051805
const widgetIndex = this.widgets.indexOf(widget)
18061806
if (widgetIndex === -1) throw new Error("Widget not found on this node")
18071807

1808+
// Clean up slot references to prevent memory leaks
1809+
if (this.inputs) {
1810+
for (const input of this.inputs) {
1811+
if (input._widget === widget) {
1812+
input._widget = undefined
1813+
delete input.widget
1814+
}
1815+
}
1816+
}
1817+
18081818
this.widgets.splice(widgetIndex, 1)
18091819
}
18101820

0 commit comments

Comments
 (0)