changeset 6163:e46275203449

RT-35224: [TableView] NestedTableColumnHeader crashes in dispose() during layout
author jgiles
date Wed, 22 Jan 2014 11:15:57 +1300
parents cf90e9eb59f0
children ed47253a8c3b
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java modules/controls/src/test/java/javafx/scene/control/TableViewTest.java
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed Jan 22 11:02:01 2014 +1300
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed Jan 22 11:15:57 2014 +1300
@@ -317,9 +317,8 @@
             TableColumnHeader header = getColumnHeaders().get(i);
             header.dispose();
         }
-        
-        for (int i = 0; i < dragRects.size(); i++) {
-            Rectangle rect = dragRects.get(i);
+
+        for (Rectangle rect : dragRects.values()) {
             if (rect != null) {
                 rect.visibleProperty().unbind();
             }
--- a/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java	Wed Jan 22 11:02:01 2014 +1300
+++ b/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java	Wed Jan 22 11:15:57 2014 +1300
@@ -2056,4 +2056,19 @@
         assertEquals("Andrew", person1.getFirstName());
         assertEquals(1, test_rt_34685_commitCount);
     }
+
+    @Test public void test_rt_35224() {
+        TableView table = new TableView();
+        TableColumn col1 = new TableColumn();
+        TableColumn col2 = new TableColumn();
+        table.getColumns().setAll(col1, col2);
+
+        new StageLoader(table);
+
+        Toolkit.getToolkit().firePulse();
+        col1.getColumns().setAll(new TableColumn(), new TableColumn());
+        Toolkit.getToolkit().firePulse();
+        col2.getColumns().setAll(new TableColumn(), new TableColumn());
+        Toolkit.getToolkit().firePulse();
+    }
 }