Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#556 closed defect (fixed)

collections.Set.union function loops infinitely

Reported by: anonymous Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

the loop to add properties from the second array parameter is missing the line e.moveNext(); leading to an infinite loop.

Change History (5)

comment:1 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: newclosed

Not sure what version of this code you are using but the line is there and passes unit tests.

comment:2 Changed 13 years ago by neil@…

Resolution: fixed
Status: closedreopened

I have just (30 March 2006) downloaded the 'kitchen sink' distribution 0.2.2 - the line is missing! dojo-0.2.2-kitchen_sink/src/collections/Set.js

... dojo.collections.Set = new function(){

this.union = function(setA, setB){

if (setA.constructor == Array) var setA = new dojo.collections.ArrayList?(setA); if (setB.constructor == Array) var setB = new dojo.collections.ArrayList?(setB);

if (!setA.toArray
!setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");

var result = new dojo.collections.ArrayList?(setA.toArray()); var e = setB.getIterator(); while (!e.atEnd){

if (!result.contains(e.current)) result.add(e.current);

} return result;

};

look at the while loop - how is e being iterated?

comment:3 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: reopenedclosed

The 0.2.2 release contained this bug; the trunk does not. If you are using the Set stuff, probably you should grab the nightly or fix it in your local copy.

It *is* fixed in the nightlies, therefore this is closed.

comment:4 Changed 13 years ago by bill

Milestone: 0.3release

comment:5 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.