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

 
 

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

Submitted by:  Philipp Sibler <philsee>
Submitted on:  Thu 04 Feb 2021 09:41:17 PM UTC  
 
Category:  Interpreter 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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 philsee (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5