Mercurial > octave
changeset 25318:b328ff3ce0f7 stable
call delete method for handle class objects (bug #46497)
* ov-classdef.cc (handle_cdef_object::handle_cdef_object):
Call delete_object to ultimately invoke the delete method for the
object.
* test/bug-46497/bug-46497.tst, test/bug-46497/class_bug46497.m,
test/bug-46497/module.mk: New files.
* test/module.mk: Update.
author | Piotr Held <pjheld@gmail.com> |
---|---|
date | Thu, 02 Nov 2017 10:27:11 -0700 |
parents | 4a46c83bcb71 |
children | 56201aad3462 |
files | libinterp/octave-value/ov-classdef.cc test/bug-46497/bug-46497.tst test/bug-46497/class_bug46497.m test/bug-46497/module.mk test/module.mk |
diffstat | 5 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc Thu Apr 26 21:19:41 2018 -0400 +++ b/libinterp/octave-value/ov-classdef.cc Thu Nov 02 10:27:11 2017 -0700 @@ -1788,6 +1788,9 @@ handle_cdef_object::~handle_cdef_object (void) { + // Call classdef "delete()" method on object + get_class ().delete_object (get_class ()); + #if DEBUG_TRACE std::cerr << "deleting " << get_class ().get_name () << " object (handle)" << std::endl;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-46497/bug-46497.tst Thu Nov 02 10:27:11 2017 -0700 @@ -0,0 +1,24 @@ +## Copyright (C) 2017 Piotr Held +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +%!test +%! global __bug46497_global__ +%! __bug46497_global__ = 'test_bug46497'; +%! a = class_bug46497 (); +%! a = []; +%! assert(__bug46497_global__,'deleted'); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-46497/class_bug46497.m Thu Nov 02 10:27:11 2017 -0700 @@ -0,0 +1,8 @@ +classdef class_bug46497 < handle + methods + function delete (self) + global __bug46497_global__ + __bug46497_global__ = 'deleted'; + endfunction + endmethods +endclassdef
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-46497/module.mk Thu Nov 02 10:27:11 2017 -0700 @@ -0,0 +1,5 @@ +bug_46497_TEST_FILES = \ + %reldir%/bug-46497.tst \ + %reldir%/class_bug46497.m + +TEST_FILES += $(bug_46497_TEST_FILES)
--- a/test/module.mk Thu Apr 26 21:19:41 2018 -0400 +++ b/test/module.mk Thu Nov 02 10:27:11 2017 -0700 @@ -56,6 +56,7 @@ include %reldir%/bug-38691/module.mk include %reldir%/bug-41723/module.mk include %reldir%/bug-44940/module.mk +include %reldir%/bug-46497/module.mk include %reldir%/bug-46660/module.mk include %reldir%/bug-49379/module.mk include %reldir%/bug-50014/module.mk