Skip to content

Fix ConcurrentModificationException in View draw loops - #130

Open
leniver wants to merge 1 commit into
ldtteam:version/mainfrom
leniver:fix/cme-in-view-draw-loops
Open

Fix ConcurrentModificationException in View draw loops#130
leniver wants to merge 1 commit into
ldtteam:version/mainfrom
leniver:fix/cme-in-view-draw-loops

Conversation

@leniver

@leniver leniver commented Sep 4, 2026

Copy link
Copy Markdown

Closes #129

Changes proposed in this pull request

  • View#drawSelf, #drawHidden and #drawSelfLast iterated the live children list, so a structural change to it during a render pass crashed the client with ConcurrentModificationException. Stack and analysis are in ConcurrentModificationException in View#drawSelf when children are modified during rendering #129.
  • Applied the same defensive copy that View#onUpdate already uses (new ArrayList<>(children)) to those three draw paths. Scope is kept to the per-frame draw methods; findPaneByID, findPaneByType, setWindow and the reverse listIterator in mouseEventProcessor are left as-is. Happy to widen it if you would prefer the whole class handled at once.

Testing

  • Yes I tested this before submitting it.
  • I also did a multiplayer test.

View#drawSelf, #drawHidden and #drawSelfLast iterated the live children
list. A structural change to that list during a render pass crashed the
client with ConcurrentModificationException.

View#onUpdate already guarded against this by iterating a copy; apply the
same treatment to the three draw paths.

Fixes ldtteam#129
@CLAassistant

CLAassistant commented Sep 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Thodor12

Thodor12 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fill in the pull request template accordingly.

@Thodor12 Thodor12 closed this Sep 4, 2026
@leniver

leniver commented Sep 4, 2026

Copy link
Copy Markdown
Author

I've updated the pull request to match the template.

@Thodor12 Thodor12 reopened this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConcurrentModificationException in View#drawSelf when children are modified during rendering

4 participants