Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8123070

Can't change ComboBox value in change listener

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • None

      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).




            jgiles Jonathan Giles
            psafrata Pavel Šafrata
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: