bugGNU Octave - Bugs: bug #32182, data loss in hierarchical objects

 
 

bug #32182: data loss in hierarchical objects

Submitted by:  Volkmar Glauche <glauche>
Submitted on:  Wed Jan 19 21:03:46 2011  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Jaroslav Hajek <highegg>
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat Jan 22 12:56:05 2011, comment #2:

Well, frankly, the inheritance model for the old style classes is a steaming pile of crap and nowadays you can't even get a decent doc from matlab telling us how it should be done.

If the new-style classes were at least on the way, I'd simply drop the support. Octave never worked correctly in that regard anyway.

That being said, I believe this patch solves the issue:
http://hg.savannah.gnu.org/hgweb/octave/rev/b83162e8f402

There is a separate problem with display only succeeding once, but I believe that's orthogonal to this issue. I'll make it a separate bug.
Nevertheless, inspecting the class's fields with aid of struct() suggests that it works as intended now, so I'm closing this.

Jaroslav Hajek <highegg>In charge of this item.
Sat Jan 22 09:11:00 2011, comment #1:

Jaroslav, could you please take a look at this problem? There seems to be some issue with reference counting here, as the call to the manipulate method is somehow changing the size of item.baseobj.val (a cell array of objects). I'm not yet seeing where that is happening and since you've done a lot of work with indexing and assignment for classes, maybe you will spot it sooner than I can.

I'm not sure whether it will give you some clues or help with debugging, but rewriting the @derivobj/manipulate.m function from

to

+vertabim+
function item = manipulate(item)

% manipulate the inherited 'val' field of a derivobj.
tmp = cell (1, numel(item.baseobj.val));
for k = 1:numel(item.baseobj.val)
tmp{k} = manipulate(item.baseobj.val{k});
end
item.baseobj.val = tmp;
-verbatim-

avoids the problem for me.

John W. Eaton <jwe>
Project Administrator
Wed Jan 19 21:03:46 2011, original submission:

I have got a hierarchy of object classes:
baseobj
derivobj - derived from baseobj
deriv2obj - derived from derivobj

baseobj and derivobj define a method manipulate(). In baseobj, this method assigns a random number to the .val property. In derivobj/deriv2obj, it calls a manipulate() method on each member of a cell array .val. While manipulate() operates correctly on derivobj objects, it crashes on deriv2obj objects:

The error occurs in the for loop in @derivobj/manipulate, when trying to access the .val field entries in a deriv2obj. The same code works perfectly for derivobj objects.

Volkmar Glauche <glauche>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #22459:  deriv2obj.tgz added by glauche (3kB - application/x-compressed-tar)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by highegg (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jwe
  • -unavailable- added by glauche (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Apr 12 15:39:52 2011dbatemanDependencies-=>bugs #33014 is dependent
    Sat Jan 22 12:56:05 2011higheggStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat Jan 22 09:17:52 2011higheggAssigned toNone=>highegg
    Sat Jan 22 09:11:00 2011jweCarbon-Copy-=>Added highegg
    Wed Jan 19 21:03:46 2011glaucheAttached File-=>Added deriv2obj.tgz, #22459

    Back to the top


    Powered by Savane 3.1-cleanup