bugGNU Octave - Bugs: bug #47241, classdef: assigning property of...

 
 

bug #47241: classdef: assigning property of handle object in object array constructs new object

Submitter:  None
Submitted:  Tue 23 Feb 2016 11:40:10 PM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Philip Roth Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Wed 29 Mar 2017 06:32:51 PM UTC, comment #1: 

I can confirm. I see the following after your test:

>> b(:).x
ans = [](0x0)
ans =  1
ans = [](0x0)
ans = [](0x0)
>> b(:).y
ans = [](0x0)
ans =  2
ans = [](0x0)
ans = [](0x0)

So indexing is off by one.
Might be related to bug #46660 which seems to also have a patch for this.

Markus M├╝tzel <mmuetzel>
Project Member
Tue 23 Feb 2016 11:40:10 PM UTC, original submission:  

With a simple handle object:

classdef bogus < handle
    properties
        x
        y
    end

    methods
        function obj = bogus(x, y)
            if nargin > 0
                obj.x = x
                obj.y = y
            end
        end
    end
end

Then create an array of objects, assign a value to one property, then the other, and the value assigned to the first property is reset (apparently because a new object was constructed and copied into that array element).

>> n = int32(4)
n = 4
>> b(n) = bogus
constructing a bogus
constructing a bogus
b =

<object array bogus>

>> b(1).x = 1
constructing a bogus
b =

<object array bogus>

>> b(1).y = 2
constructing a bogus
b =

<object array bogus>

>> b(1).x
ans = [](0x0)

Expected behavior is that b(1).x is 1, and b(1).y is 2 after the operations complete.  Same behavior observed with both Octave 4.0 and Octave 4.1 installed via MacPorts.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by None (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 project members can vote.

     

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-29 mmuetzel Dependencies- Depends on bugs #46660
    2016-06-02 mtmiller StatusNone Confirmed
        Release4.0.0 dev
        Operating SystemMac OS Any
        SummaryAssigning property of handle object in object array constructs new object classdef: assigning property of handle object in object array constructs new object

    Back to the top


    Powered by Savane 3.9