Skip to content

Clone observers before iterating#34

Open
fwdekker wants to merge 1 commit intomasterfrom
observers-copy
Open

Clone observers before iterating#34
fwdekker wants to merge 1 commit intomasterfrom
observers-copy

Conversation

@fwdekker
Copy link
Member

If an observer deregisters itself in the levelWon() or levelLost() call, Java may throw a ConcurrentModificationException while iterating the list of observers. To prevent this, this PR makes a shallow copy of the list of observers before iterating over it.

@fwdekker fwdekker added the bug Something isn't working label Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments