Run the attached application, open the combo, select "Bad value" (index 1). It results in stack overflow.
There is a change listener on the selectedIndexProperty which sets the selected index back to 0. But the combo sets it again to 1, the app back to 0 and so forth.
Here is what happens in detail:
- user selects index 1
- selection model sets index to 1 (which the app switches back to 0)
- selection model continues with setting item to the value on index 1, this searches for the new value in the item list, finds it at index 1, so it sets the index back to 1.
I'm not sure if this is a bug in our code, but the attached patch fixes it (uses the actual index for the item instead of the remembered one).
There is a change listener on the selectedIndexProperty which sets the selected index back to 0. But the combo sets it again to 1, the app back to 0 and so forth.
Here is what happens in detail:
- user selects index 1
- selection model sets index to 1 (which the app switches back to 0)
- selection model continues with setting item to the value on index 1, this searches for the new value in the item list, finds it at index 1, so it sets the index back to 1.
I'm not sure if this is a bug in our code, but the attached patch fixes it (uses the actual index for the item instead of the remembered one).