Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #3 from the parent issue:
Container.modificationCount not volatile (Container.java line 23)
modificationCount field is NOT volatile
- Mutations in one thread may not be visible to other threads reading it in
detectExternalMutation() (line 106)
- Stale snapshot reuse means cache invalidation might not trigger, causing rendering bugs
Proposed Fix
Make modificationCount volatile or replace with AtomicInteger.
Acceptance Criteria
Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #3 from the parent issue:
Container.modificationCount not volatile (
Container.javaline 23)modificationCountfield is NOT volatiledetectExternalMutation()(line 106)Proposed Fix
Make
modificationCountvolatile or replace withAtomicInteger.Acceptance Criteria
modificationCounthas proper memory visibility guaranteesdetectExternalMutation()always sees latest value