bugGNU Octave - Bugs: bug #60007, subsref indexing: No access to...

 
 

bug #60007: subsref indexing: No access to protected items in handle class destructor

Submitter:  Philipp Sibler <philsee>
Submitted:  Thu 04 Feb 2021 09:41:17 PM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 6.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 04 Feb 2021 09:41:17 PM UTC, original submission:  

I generate several objects of a handle class. The destructor in this handle class calls the protected method 'sendCommand' defined wihtin the same class.

Case 1: When clearing the objects individually ("clear myObj1, clear myObj2, ..."), the destructor each time is getting called properly, no problems.

Case 2: When I clear the entire environment with a "clear all" I get the following warning for each destructed class object:

warning: error caught while executing handle class delete method:
subsref: method 'sendCommand' has protected access and cannot be run in this context



Code example to force the issue
-------------------------------

classdef myClass < handle
  properties

  end
  methods
     function obj = myClass()

     end

     function delete(obj)
        obj.sendCommand(1);
     end
  end
  methods(Access=protected)
     function sendCommand(obj, cmd)
       fprintf('sendCommand called!\n');
     end
  end
end

Philipp Sibler <philsee>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by philsee (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-23 mmuetzel CategoryInterpreter Classdef

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code