From 724fad67013cc5c8f3e8a22d5cca782133e75ab9 Mon Sep 17 00:00:00 2001 From: TheFGFSEagle Date: Sat, 9 Dec 2023 04:13:13 +0100 Subject: [PATCH] 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. --- Nasal/canvas/api/canvas.nas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Nasal/canvas/api/canvas.nas b/Nasal/canvas/api/canvas.nas index ea0db6304..06f7366b4 100644 --- a/Nasal/canvas/api/canvas.nas +++ b/Nasal/canvas/api/canvas.nas @@ -64,6 +64,10 @@ var Canvas = { # # releases associated canvas and makes this object unusable 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.parents = nil; # ensure all ghosts get destroyed }