Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #5 from the parent issue:
MockNcursesBridge.setTerminalSize() not synchronized (MockNcursesBridge.java lines 129-159)
- Does not synchronize access to
width/height/screen fields
- Concurrent calls to
getTerminalWidth()/getTerminalHeight() could read torn/inconsistent values
- Concurrent resize could cause
ArrayIndexOutOfBoundsException if screen buffer is swapped mid-operation
Proposed Fix
Add synchronized modifier to setTerminalSize() and coordinate with getTerminalWidth(), getTerminalHeight(), and screen buffer access methods.
Acceptance Criteria
Part of #224: Improve Thread Safety in Component and Container
Scope
Address issue #5 from the parent issue:
MockNcursesBridge.setTerminalSize() not synchronized (
MockNcursesBridge.javalines 129-159)width/height/screenfieldsgetTerminalWidth()/getTerminalHeight()could read torn/inconsistent valuesArrayIndexOutOfBoundsExceptionif screen buffer is swapped mid-operationProposed Fix
Add
synchronizedmodifier tosetTerminalSize()and coordinate withgetTerminalWidth(),getTerminalHeight(), and screen buffer access methods.Acceptance Criteria
setTerminalSize()is synchronized