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

Jeanette Winzenburg fastegal at openjdk.java.net
Mon Jun 15 07:51:39 UTC 2020


On Mon, 15 Jun 2020 06:25:36 GMT, Ambarish Rapte <arapte 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 repeated and costly operation compared to previous boolean check. I think we
> should keep the previous way of handling it: registering the change listener to `listView.fixedCellSizeProperty()`.

ehh .. last time I did such micro-optimization was in the 80ies of last century ;)

Are there any performance measurements anywhere to demonstrate the impact?

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

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


More information about the openjfx-dev mailing list