Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #4 from the parent issue:
Container.drawBorder() accesses width/height without lock (Container.java line 236)
- Accesses
width/height fields directly without acquiring renderLock
- Early return check (line 237) reads dimensions without lock
- TOCTOU race: dimensions could change between check and buffer writes
- Could cause
ArrayIndexOutOfBoundsException
Proposed Fix
Use getWidth()/getHeight() accessors or acquire renderLock before reading dimensions. Snapshot dimension values at the start of the method to prevent mid-method changes.
Acceptance Criteria
Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #4 from the parent issue:
Container.drawBorder() accesses width/height without lock (
Container.javaline 236)width/heightfields directly without acquiringrenderLockArrayIndexOutOfBoundsExceptionProposed Fix
Use
getWidth()/getHeight()accessors or acquirerenderLockbefore reading dimensions. Snapshot dimension values at the start of the method to prevent mid-method changes.Acceptance Criteria
drawBorder()reads dimensions under lock or via synchronized accessorsArrayIndexOutOfBoundsExceptionpossible from concurrent resize