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

[TableView] NestedTableColumnHeader crashes in dispose() during layout

    XMLWordPrintable

    Details

      Description

      Provoked by rearranging columns on a multi-column grid with nested columns.

      Construct a window from the following .fxml:

      <?xml version="1.0" encoding="UTF-8"?>

      <?import java.lang.*?>
      <?import javafx.scene.control.*?>
      <?import javafx.scene.layout.*?>

      <AnchorPane prefHeight="480.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8"
                  fx:controller="sample.Controller">
          <children>
              <TableView layoutX="32.0" layoutY="-13.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0"
                         AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
                         xmlns:fx="http://javafx.com/fxml">
                  <columns>
                      <TableColumn prefWidth="75.0" text="C1"/>
                      <TableColumn fx:id="middlecolumn" prefWidth="75.0" text="C2">
                          <columns>
                              <TableColumn prefWidth="75.0" text="C21"/>
                              <TableColumn prefWidth="75.0" text="C22"/>
                              <TableColumn prefWidth="75.0" text="C23"/>
                          </columns>
                      </TableColumn>
                      <TableColumn prefWidth="75.0" text="C3"/>
                  </columns>
              </TableView>
          </children>
      </AnchorPane>

      Drag the right hand most column and drop it in the table.
      See the crash.

      dispose() is getting a null reference out of dragRects.get():

              for (int i = 0; i < dragRects.size(); i++) {
                  Rectangle rect = dragRects.get(i);
                  rect.visibleProperty().unbind();
              }

      causing a stack trace in the rect.visibleProperty().unbind() call
      This appears to be caused by declaring dragRects() as a Map but treating it as a List.
      Should be fixable by using iteration over the map ...

      Stack trace:

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.dispose(NestedTableColumnHeader.java:323)
      at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.updateTableColumnHeaders(NestedTableColumnHeader.java:265)
      at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.checkState(NestedTableColumnHeader.java:519)
      at com.sun.javafx.scene.control.skin.NestedTableColumnHeader.computePrefHeight(NestedTableColumnHeader.java:401)
      at javafx.scene.Parent.prefHeight(Parent.java:918)
      at javafx.scene.layout.Region.prefHeight(Region.java:1438)
      at com.sun.javafx.scene.control.skin.TableHeaderRow.computePrefHeight(TableHeaderRow.java:344)
      at com.sun.javafx.scene.control.skin.TableHeaderRow.computeMinHeight(TableHeaderRow.java:339)
      at javafx.scene.Parent.minHeight(Parent.java:946)
      at javafx.scene.layout.Region.minHeight(Region.java:1404)
      at javafx.scene.control.SkinBase.computeMinHeight(SkinBase.java:254)
      at javafx.scene.control.Control.computeMinHeight(Control.java:485)
      at javafx.scene.Parent.minHeight(Parent.java:946)
      at javafx.scene.layout.Region.minHeight(Region.java:1404)
      at javafx.scene.layout.AnchorPane.computeHeight(AnchorPane.java:297)
      at javafx.scene.layout.AnchorPane.computeMinHeight(AnchorPane.java:246)
      at javafx.scene.Parent.minHeight(Parent.java:946)
      at javafx.scene.layout.Region.minHeight(Region.java:1404)
      at javafx.scene.layout.Region.computeChildMinAreaHeight(Region.java:1700)
      at javafx.scene.layout.BorderPane.getAreaHeight(BorderPane.java:618)
      at javafx.scene.layout.BorderPane.computeMinHeight(BorderPane.java:415)
      at javafx.scene.Parent.minHeight(Parent.java:946)
      at javafx.scene.layout.Region.minHeight(Region.java:1404)
      at javafx.scene.layout.BorderPane.layoutChildren(BorderPane.java:485)
      at javafx.scene.Parent.layout(Parent.java:1076)
      at javafx.scene.Parent.layout(Parent.java:1082)
      at javafx.scene.Parent.layout(Parent.java:1082)
      at javafx.scene.Scene.doLayoutPass(Scene.java:568)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2367)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:330)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:479)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
      at com.sun.javafx.tk.quantum.QuantumToolkit$13.run(QuantumToolkit.java:327)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
      at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
      at java.lang.Thread.run(Thread.java:744)

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: