ComboBox: fixed StackOverflowError when using single renderer instance in multiple comboboxes (regression since commit 4507ce359d)

This commit is contained in:
Karl Tauber
2021-07-09 11:39:35 +02:00
parent ff9ef21f67
commit 1de81d0af5
3 changed files with 95 additions and 2 deletions

View File

@@ -791,14 +791,20 @@ public class FlatComboBoxUI
if( oldBorder == this )
return; // already installed
// component already has a padding border --> uninstall it
// (may happen if single renderer instance is used in multiple comboboxes)
if( oldBorder instanceof CellPaddingBorder )
((CellPaddingBorder)oldBorder).uninstall();
// this border can be installed only at one component
// (may happen if a renderer returns varying components)
uninstall();
// remember component where this border was installed for uninstall
rendererComponent = jc;
// remember old border and replace it
rendererBorder = oldBorder;
rendererBorder = jc.getBorder();
rendererComponent.setBorder( this );
}