diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2013-05-30 14:37:01 +0200 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2013-05-30 18:24:10 +0200 |
commit | fcec27575659b75275b38687e81cb677b0a452aa (patch) | |
tree | 5203ac3bff894a138c3aec752379bb58eedc7a13 /src/library | |
parent | 1c6a0cf75592c201e27a6e11140c6da87de67123 (diff) | |
download | scala-fcec27575659b75275b38687e81cb677b0a452aa.tar.gz scala-fcec27575659b75275b38687e81cb677b0a452aa.tar.bz2 scala-fcec27575659b75275b38687e81cb677b0a452aa.zip |
SI-7498 ParTrieMap.foreach no longer crashes
Previously, the `split` method of the `ParTrieMap` iterator threw
an exception when splitting a splitter that iterated over nodes
whose hash codes collide.
This was due to reusing the iterator of the list of colliding keys
rather than creating a new splitter.
This commit changes the `subdivide` method to create a new
iterator using the factory method of the current trie map
iterator rather than returning a `LinearSeqLike` iterator.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/concurrent/TrieMap.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library/scala/collection/concurrent/TrieMap.scala b/src/library/scala/collection/concurrent/TrieMap.scala index 0b5ceeb1c7..6632f30e51 100644 --- a/src/library/scala/collection/concurrent/TrieMap.scala +++ b/src/library/scala/collection/concurrent/TrieMap.scala @@ -1012,8 +1012,11 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct: */ protected def subdivide(): Seq[Iterator[(K, V)]] = if (subiter ne null) { // the case where an LNode is being iterated - val it = subiter - subiter = null + val it = newIterator(level + 1, ct, _mustInit = false) + it.depth = -1 + it.subiter = this.subiter + it.current = null + this.subiter = null advance() this.level += 1 Seq(it, this) |