diff --git a/Nasal/canvas/api.nas b/Nasal/canvas/api.nas index 8ef97c216..96d9d72bb 100644 --- a/Nasal/canvas/api.nas +++ b/Nasal/canvas/api.nas @@ -753,6 +753,14 @@ var Canvas = { getPath: func() { return "canvas://by-index/texture[" ~ me.texture.getIndex() ~ "]"; + }, + # Destructor + # + # releases associated canvas and makes this object unusable + del: func + { + me.texture.remove(); + me.parents = nil; # ensure all ghosts get destroyed } }; diff --git a/Nasal/canvas/gui.nas b/Nasal/canvas/gui.nas index c70f647e6..44c91dd16 100644 --- a/Nasal/canvas/gui.nas +++ b/Nasal/canvas/gui.nas @@ -15,6 +15,13 @@ var Dialog = { return m; }, + # Destructor + del: func + { + me.parents[1].del(); + if( me["_canvas"] != nil ) + me._canvas.del(); + }, # Create the canvas to be used for this dialog # # @return The new canvas