RFR: 8246745: ListCell/Skin: misbehavior on switching skin

Ambarish Rapte arapte at openjdk.java.net
Mon Jun 15 06:27:55 UTC 2020

On Wed, 10 Jun 2020 12:25:04 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:

> ListCellSkin installs listeners to the ListView/fixedCellSize that introduce a memory leak, NPE on replacing the
> listView and incorrect update of internal state (see bug report for details)
> Fixed by removing the listeners (and the internal state had been copied from listView on change) and access of listView
> state when needed.
> Added tests that failed before and pass after the fix, plus a sanity test to guarantee same (correct) behavior
> before/after.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ListCellSkin.java line 100:

> 99:         double fixedCellSize = getFixedCellSize();
> 100:         if (fixedCellSize > 0) {
> 101:             return fixedCellSize;

These compute methods get invoked multiple times during each layout pass(10s of times). Fetching the fixed cell size on
each call to these methods seems to be costly and repeated operation compared to previous boolean check. I think we
should keep the previous way of handling it: registering the change listener to `listView.fixedCellSizeProperty()`.


PR: https://git.openjdk.java.net/jfx/pull/251

More information about the openjfx-dev mailing list