Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1346 closed defect (fixed)

TreeSelectorV3.js, bug in onLabelClick function, modifying array while looping it.

Reported by: parseint Owned by: ilia
Priority: high Milestone:
Component: General Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

TreeSelectorV3.js, in 'onLabelClick' function:

When selecting a node that's already selected, and there's more selected nodes, it's looping through all the nodes and deselecting them (except the one we clicked). But in the foreach loop it's looping through this.selectedNodes, and splicing it as it iterates (in 'deselect' function), this produces undesired results.

Fix suggestion: Make an independent copy of the array:

var newArray = this.selectedNodes.slice(); dojo.lang.forEach(newArray, function(selectedNode) {

if (selectedNode !== node) {

_this.deselect(selectedNode);

}

});

Change History (3)

comment:1 Changed 13 years ago by dylan

Milestone: 0.4
Owner: changed from anonymous to ilia

comment:2 Changed 13 years ago by ilia

Resolution: fixed
Status: newclosed

Fixed array traversal

comment:3 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.