On Mon, 1 Jun 2026 01:43:45 GMT, Christopher Schnick <[email protected]> 
wrote:

> This is a much simpler fix for JDK-8384806 which does not have any side 
> effects.
> 
> This restores the old code with only a one line change instead. For 
> reference, see 
> https://github.com/openjdk/jfx/commit/8d917ae738120e12ac12cd0957879b7c00e59b03.
>  We now fix the issue by clearing the cell with `buttonCell.updateIndex(-1);` 
> as using `buttonCell.setItem(null);` was causing the original issue when the 
> item was already null.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

About reprodution: Set the button cell to "With Icon" and select any value from 
the list. Then, change the converter. This should remove the graphic. There are 
probably more niche cases where the graphics gets removed on master.

@Maran23 I looked through the code and it seems like the ComboBox realizes 
updates in the button cell by setting the value to null and then reselecting 
the value to force a call to updateItem(). This is correct as something 
happened that we can't observe, i.e. the converter changing. Touching anything 
on that side leads to unintended side effects like this one, so I chose to just 
keep it. This PR is only an effective one-line change now from the original 
code, much better than before.

The bug with a selected contained null value not updating is because calling 
setItem(null) does not reset the cell as intended if null is already the 
selected value. That is why it uses setIndex() now

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2179#issuecomment-4597292456

Reply via email to