Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clone VMHashInstance.storage before building an Iterator.
Otherwise we get ConcurrentModificationException thrown when changing a Hash
while iterating over it.
  • Loading branch information
peschwa committed Sep 16, 2015
1 parent 0c380a8 commit 4740820
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -3391,7 +3391,7 @@ else if (agg.st.REPR instanceof VMHash) {
SixModelObject iterType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.hashIteratorType;
VMIterInstance iter = (VMIterInstance)iterType.st.REPR.allocate(tc, iterType.st);
iter.target = agg;
iter.hashKeyIter = ((VMHashInstance)agg).storage.keySet().iterator();
iter.hashKeyIter = ((HashMap)((VMHashInstance)agg).storage.clone()).keySet().iterator();
iter.iterMode = VMIterInstance.MODE_HASH;
return iter;
}
Expand Down

0 comments on commit 4740820

Please sign in to comment.