bugGNU Octave - Bugs: bug #46497, classdef: delete destructor method...

 
 

bug #46497: classdef: delete destructor method is not called when clearing handle class

Submitted by:  None
Submitted on:  Sun 22 Nov 2015 09:01:54 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Marco MerlinOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 02 Nov 2017 06:14:33 PM UTC, comment #2:

And I tested it as extensively as I could with no side effects.

The destructor is called only when clearing an object that inherits from handle and not when a classdef does not inherit from handle.

The way I arrived at this solution was to turn on DEBUG_TRACES in ov-classdef.cc and then I found the location where the handle_cdef_object destructor is called. That's where I added the cdef_class::delete_object() function which calls the classdef "delete()" method.

I also wrote a tests for the problem.

The patch filename is:
patch_classdef_destructor_bug46497.diff

(file #42322)

Piotr Held <jsoh425>
Sat 28 Nov 2015 11:33:27 AM UTC, comment #1:

I can confirm the issue on Octave 4.0.0 and ubuntu.

Anonymous
Sun 22 Nov 2015 09:01:54 PM UTC, original submission:

I have created a superclass inheriting from handle, an example here:

Here is the Matlab behavior, sticking to my expectations, deleting the class when clearing the reference.

On the contrary, Octave does not execute the delete method.

Similarly, following suggestion from here
http://stackoverflow.com/questions/14057308/matlab-class-destructor-not-called-during-clear, I have tried to use the onCleanup event

Here is what Matlab does, even though it is not clear now what actually triggers the destructor.

And here is Octave still happily avoiding the destructor.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #35522:  myClass.m added by None (131B - text/x-objcsrc)
file #35523:  myClass_cleanup.m added by None (289B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jsoh425 (Updated the item)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by cbm
  • -unavailable- added by cbm
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 02 Nov 2017 06:14:33 PM UTCjsoh425Attached File-=>Added patch_classdef_destructor_bug46497.diff, #42322
    Thu 02 Jun 2016 03:46:34 AM UTCmtmillerStatusNone=>Confirmed
      Release4.0.0=>dev
      Operating SystemMicrosoft Windows=>Any
      Summarydelete class destructor is not called when clearing handle class=>classdef: delete destructor method is not called when clearing handle class
    Thu 26 May 2016 04:37:49 AM UTCcbmCarbon-Copy-=>Added cbm
      Carbon-Copy-=>Added mtmiller
    Sun 22 Nov 2015 09:01:54 PM UTCNoneAttached File-=>Added myClass.m, #35522
      Attached File-=>Added myClass_cleanup.m, #35523

    Back to the top


    Powered by Savane 3.1-cleanup1