Commit 5687b8cc authored by Nico Mack's avatar Nico Mack

Minor improvement to paint method in order to avoid potential

ConcurrentModificationExceptions
parent ee9046b2
......@@ -315,7 +315,11 @@ public class BaseWidget implements Touchable {
public void paint(Graphics2D canvas) {
clippingRegion.reset();
for (Corona corona : coronas.values()) {
// Create a snapshot of the corona multimap in order to avoid potential
// ConcurrentModificationExceptions caused by modifications to the corona
// multimap in other threads
Corona[] snapshot = coronas.values().toArray(new Corona[0]);
for (Corona corona : snapshot) {
if ((corona != null) && corona.isInvalidated()) {
corona.paint(canvas);
clippingRegion.add(new Area(corona.getClippingRegion().getBounds()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment