DescriptionChange ListIterator to only check for concurrent modification at each iteration
in checked mode.
It also checks at the end in all cases.
Iteration only goes from 0 to the original length of the list.
This ensures that iterating a list while adding to it (like by x.addAll(x))
is caught instead of growing until out-of-memory.
For well-behaved programs this makes no difference since length and original
length stay the same.
Also, it means that calling moveNext again later, after increasing the length,
will not make iteration continue. After returning false, iteration is always
done.
However, it means that reducing the length causes an out-of-range read before
reaching the end, and before a concurrent modification error can happen.
R=sra@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45198
Patch Set 1 #Patch Set 2 : Check iterable.length on each iteration. #Patch Set 3 : Changelog. #
Messages
Total messages: 11 (2 generated)
|