octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53844] handle class: delete destructor method


From: anonymous
Subject: [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties
Date: Sat, 5 May 2018 19:57:02 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

URL:
  <http://savannah.gnu.org/bugs/?53844>

                 Summary: handle class: delete destructor method cannot access
class properties
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sat 05 May 2018 11:57:01 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Michael Quellmalz
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

The delete destructor method in a class handle seems to be unable to access
properties of the class. Here is an example:


classdef myClass < handle
  properties
    d;
  end
  methods
    function h=myClass(d)
      h.d=d;
    end
    function delete(h)
      disp('Destructor called');
      x=h.d;
      disp(x);
    end
  end
end


This produces the following error:

>> h=myClass(4); clear h
Destructor called
warning: error caught while executing handle class delete method:
value on right hand side of assignment is undefined


So the delete method cannot access the property 'd'.

However, calling the delete method directly, it works fine:

>> h=myClass(4); delete(h)
Destructor called
 4


This behavior seems to be new in Octave 4.4.0, because previously the
destructor was not called at all, see bug #46497
<https://savannah.gnu.org/bugs/?46497>. I tested this on octave-4.4.0-w64 on
Windows.

Is it possible that the clear command deletes the properties of the class
before calling the 'delete' method?




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53844>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]