[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53844] handle class: delete destructor method
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties |
Date: |
Mon, 14 May 2018 19:53:01 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 |
Follow-up Comment #13, bug #53844 (project octave):
Thank you, this improves things quite a bit. I still have one more case where
this deferred deletion does not work, where a temporary instance of a class is
deleted too soon.
Consider the following toy class
classdef toyclass < handle
properties
value
endproperties
methods
function self = toyclass (x)
if (nargin < 1)
x = 0;
endif
self.value = x;
endfunction
function delete (self)
fprintf (stderr, '');
endfunction
function ret = subsref (self, idx)
ret = self.value;
endfunction
endmethods
endclassdef
And the following examples
>> x = toyclass;
>> x.value
ans = 0
>> class (toyclass)
ans = toyclass
>> size (toyclass)
ans =
1 1
>> toyclass ().value
>>
In the last statement, the constructor returns a valid object, but it is
deleted before the subsref is done successfully on the temporary value.
As before, if there is no delete method, or if the body of the delete method
is empty, this problem does not appear.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53844>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, (continued)
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/11
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/11
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/11
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Rik, 2018/05/11
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/11
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/12
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/13
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/13
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties,
Mike Miller <=
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/14
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, John W. Eaton, 2018/05/15
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Richard, 2018/05/22
- [Octave-bug-tracker] [bug #53844] handle class: delete destructor method cannot access class properties, Mike Miller, 2018/05/22