1
0
Fork 0

Fix placements not being removed when destroying a canvas

Canvas placements are being added / removed through a listener on "placement" node adds / removals on the canvas's node.
Previously, when the canvas's del method was called, the canvas's node was removed, but not its "placement" subnodes.
This caused the canvas to be destroyed without the placements being removed.
This in turn causes problems when setting up a canvas with the same placement(s).
This is fixed by this commit by removing the "placement" nodes separately before destroying the canvas.
This commit is contained in:
TheFGFSEagle 2023-12-09 04:13:13 +01:00 committed by James Turner
parent de7a49a456
commit 724fad6701

View file

@ -64,6 +64,10 @@ var Canvas = {
# #
# releases associated canvas and makes this object unusable # releases associated canvas and makes this object unusable
del: func { del: func {
# explicitly remove placement nodes. This should in principle not
# be required (since _node.remove() should also clean them up)
me._node.removeChildren("placement");
me._node.remove(); me._node.remove();
me.parents = nil; # ensure all ghosts get destroyed me.parents = nil; # ensure all ghosts get destroyed
} }