From 7bf96db69106bc39c39cdf2b75042506af08e838 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 21 Jul 2013 11:31:41 +0200 Subject: [PATCH] canvas.Window: Do not delete canvas on close if other placements exist. --- Nasal/canvas/gui.nas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Nasal/canvas/gui.nas b/Nasal/canvas/gui.nas index 956724b54..294c5bb68 100644 --- a/Nasal/canvas/gui.nas +++ b/Nasal/canvas/gui.nas @@ -26,14 +26,24 @@ var Window = { # Destructor del: func { - me._node.remove(); - me._node = nil; - if( me["_canvas"] != nil ) { - me._canvas.del(); + var placements = me._canvas.texture.getChildren("placement"); + # Do not remove canvas if other placements exist + if( size(placements) > 1 ) + foreach(var p; placements) + { + if( p.getValue("type") == "window" + and p.getValue("id") == me.get("id") ) + p.remove(); + } + else + me._canvas.del(); me._canvas = nil; } + + me._node.remove(); + me._node = nil; }, # Create the canvas to be used for this Window #