mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
fixed "endless recursion in font" exception in FlatLaf$ActiveFont.createValue() if UIManager.getFont() is invoked from multiple threads (issue #456)
This commit is contained in:
@@ -1223,6 +1223,9 @@ public abstract class FlatLaf
|
||||
}
|
||||
|
||||
private Object getValue( Object key ) {
|
||||
// use local variable for getters to avoid potential multi-threading issues
|
||||
List<Function<Object, Object>> uiDefaultsGetters = FlatLaf.this.uiDefaultsGetters;
|
||||
|
||||
if( uiDefaultsGetters == null )
|
||||
return null;
|
||||
|
||||
@@ -1276,8 +1279,9 @@ public abstract class FlatLaf
|
||||
this.scaleSize = scaleSize;
|
||||
}
|
||||
|
||||
// using synchronized to avoid exception if invoked at the same time on multiple threads
|
||||
@Override
|
||||
public Object createValue( UIDefaults table ) {
|
||||
public synchronized Object createValue( UIDefaults table ) {
|
||||
if( inCreateValue )
|
||||
throw new IllegalStateException( "FlatLaf: endless recursion in font" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user