JDK-8217953 : NullPointerException when TableCellSkin gets disposed twice
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: openjfx11
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-01-25
  • Updated: 2020-08-25
  • Resolved: 2020-08-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
openjfx16Resolved
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
If we end up in TableRowSkinBase.recreateCells() we first dispose a skin assigned to each cell and then try to set skinProperty to null which in turn leads to the skin disposal call.
The problem is that in the second TableCellSkin.dispose() call we try to retrieve a control for the skin, but it's already been disposed by the first call.

TableRowSkinBase.recreate() is called after TableRowSkinBase.fullRefreshCounter riches 0. 
The counter is decreased each time TableRowSkinBase.updateCells(true) is called.

This was triggered by an attempt to redraw a table by the trick:

table.getColumns().get(0).setVisible(false);
table.getColumns().get(0).setVisible(true);

after each insertion to the table.



Comments
both examples are working now without errors, fixed by JDK-8244112
09-06-2020

Attached a test program that reliably reproduces the problem. See https://mail.openjdk.java.net/pipermail/openjfx-dev/2020-February/025067.html
14-02-2020

Observed the exception as mentioned in previous comment, Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at javafx.controls/javafx.scene.control.skin.TableCellSkin.tableColumnProperty(TableCellSkin.java:97) Attached sample program to reproduce the issue. Just compile and execute the program to observe the exception.
14-02-2019

Response from Submitter: ================== unfortunately I couldn't easily reproduce the issue with a PoC. But I have a stacktrace, maybe it can lit some light? Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at javafx.controls/javafx.scene.control.skin.TableCellSkin.tableColumnProperty(TableCellSkin.java:97) at javafx.controls/javafx.scene.control.skin.TableCellSkinBase.getTableColumn(TableCellSkinBase.java:123) at javafx.controls/javafx.scene.control.skin.TableCellSkinBase.dispose(TableCellSkinBase.java:136) at javafx.controls/javafx.scene.control.skin.TableCellSkin.dispose(TableCellSkin.java:88) at javafx.controls/javafx.scene.control.Control$2.invalidated(Control.java:267) at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.base/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147) at javafx.graphics/javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82) at javafx.controls/javafx.scene.control.Control$2.set(Control.java:250) at javafx.controls/javafx.scene.control.Control$2.set(Control.java:233) at javafx.controls/javafx.scene.control.Control.setSkin(Control.java:230) at javafx.controls/javafx.scene.control.skin.TableRowSkinBase.recreateCells(TableRowSkinBase.java:715) at javafx.controls/javafx.scene.control.skin.TableRowSkinBase.updateCells(TableRowSkinBase.java:505) at javafx.controls/javafx.scene.control.skin.TableRowSkinBase.checkState(TableRowSkinBase.java:649) at javafx.controls/javafx.scene.control.skin.TableRowSkinBase.computePrefHeight(TableRowSkinBase.java:588) at javafx.controls/javafx.scene.control.Control.computePrefHeight(Control.java:570) at javafx.graphics/javafx.scene.Parent.prefHeight(Parent.java:1037) at javafx.graphics/javafx.scene.layout.Region.prefHeight(Region.java:1559) at javafx.controls/javafx.scene.control.skin.VirtualFlow.resizeCellSize(VirtualFlow.java:1863) at javafx.controls/javafx.scene.control.skin.VirtualFlow.addLeadingCells(VirtualFlow.java:1948) at javafx.controls/javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1250) at javafx.controls/javafx.scene.control.skin.VirtualFlow$5.invalidated(VirtualFlow.java:837) at javafx.base/javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:113) at javafx.base/javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:148) at javafx.controls/javafx.scene.control.skin.VirtualFlow.setCellCount(VirtualFlow.java:855) at javafx.controls/javafx.scene.control.skin.TableViewSkinBase.updateItemCount(TableViewSkinBase.java:549) at javafx.controls/javafx.scene.control.skin.VirtualContainerBase.checkState(VirtualContainerBase.java:170) at javafx.controls/javafx.scene.control.skin.VirtualContainerBase.layoutChildren(VirtualContainerBase.java:145) at javafx.controls/javafx.scene.control.skin.TableViewSkinBase.layoutChildren(TableViewSkinBase.java:407) at javafx.controls/javafx.scene.control.Control.layoutChildren(Control.java:601) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1204) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1211) at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:576) at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2482) at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412) at java.base/java.security.AccessController.doPrivileged(Native Method) at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411) at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) at java.base/java.lang.Thread.run(Thread.java:834) in this line at javafx.controls/javafx.scene.control.skin.TableRowSkinBase.recreateCells(TableRowSkinBase.java:715) straight after we've disposed a skin, we try to set the skin property to null, which actually lead to the second attempt to dispose the skin. =========================
30-01-2019