JDK-8274061 : Tree-/TableRowSkin: misbehavior on switching skin
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: openjfx17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-09-21
  • Updated: 2021-11-25
  • Resolved: 2021-11-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx18Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Description
misbehavior:

memory leak 
- manually registered listener to itemProperty not removed (TableRowSkinBase)
- logic error in add/remove listener to fixedCellSize (Tree/TableRowSkin)

NPE 
- due to access of skinnable after dispose, from listener to visibleLeafColumns and itemProperty (TableRowSkinBase)

The cleanup will
- change listener registration to use skinBase api always (for automatic removal in dispose)
- replace listening to fixedCellSize by looking up the value as needed: this is basically the same as the fix for ListCellSkin JDK-8246745

Comments
Changeset: d14be6a8 Author: Jeanette Winzenburg <fastegal@openjdk.org> Date: 2021-11-25 12:45:33 +0000 URL: https://git.openjdk.java.net/jfx/commit/d14be6a811591df70ef99fd6ec5448423be6fb7d
25-11-2021

stepping back from planned fix strategy: "replace listening to fixedCellSize by looking up the value as needed" Doing so introduced the side effect of horizontal scrollbar being incorrectly initialized if tree/table has many columns and fixedCellSize set (then the thumb covers nearly all its width initially, shrinking to its correct size only after scrolling to the end of row). The underlying reason for this is, that the cells are (re-)created and updated in the constructor of TableRowSkinBase - at which time isFixedCellSizeEnabled field always is false because it is set in subclasses. For some reason (which I don't fully understand ;) the initial false seems to be required to initialize the scrollbar correctly. That's a bug in itself (because the real state of the table is disrespected), might be part of the horizontal layout problems with fixedCellSize, see JDK-8185887 and related). Will not touch that to keep this issue bounded. Digging further in the issue here (that is memory leak from listening to changes of fixedCellSize): - the change listener to fixedCellSizeProperty is fine: registered via skin api and auto-removed on dispose - culprit is the manually installed invalidation listener to row's tableViewProperty: it is meant to remove itself after being notified once - which is fine if indeed it _is_ notified .. which doesn't happen for empty cells which never are attached to a tableView (don't know how that might happen) The revised fix for fixedCellSize is: - register the invalidation listener to tableViewProperty via skin api - let it register the change listener to fixedCellSizeProperty only on its first run, do nothing after the first run Note: this part of the fixed needs to be revisited: - after/when fixing JDK-8274065 (complete support change of tableView) - after/when fixing the row layout/performance problems with fixedCellSize
03-11-2021