changeset 6908:38c1ea45f8be 8u20-b12

RT-36889: Array out of bounds in VirtualFlow (caused by fix for RT-36714) Backed out changeset 410ba5840447 Backed out changeset 682a4407c437
author kcr
date Mon, 28 Apr 2014 14:04:45 -0700
parents 410ba5840447
children 2f825834e90c 66289f859d06 da036c46b124 15c983f110db
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java
diffstat 3 files changed, 3 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Mon Apr 28 13:32:22 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Mon Apr 28 14:04:45 2014 -0700
@@ -153,13 +153,8 @@
             while (c.next()) {
                 if (c.wasReplaced()) {
                     // RT-28397: Support for when an item is replaced with itself (but
-                    // updated internal values that should be shown visually).
-                    // This code was updated for RT-36714 to not update all cells,
-                    // just those affected by the change
-                    for (int i = c.getFrom(); i < c.getTo(); i++) {
-                        flow.setCellDirty(i);
-                    }
-
+                    // updated internal values that should be shown visually)
+                    itemCount = 0;
                     break;
                 } else if (c.getRemovedSize() == itemCount) {
                     // RT-22463: If the user clears out an items list then we
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Mon Apr 28 13:32:22 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Mon Apr 28 14:04:45 2014 -0700
@@ -244,17 +244,7 @@
         while (c.next()) {
             if (c.wasReplaced()) {
                 // RT-28397: Support for when an item is replaced with itself (but
-                // updated internal values that should be shown visually).
-
-                // The ListViewSkin equivalent code here was updated to use the
-                // flow.setDirtyCell(int) API, but it was left alone here, otherwise
-                // our unit test for RT-36220 fails as we do not handle the case
-                // where the TableCell gets updated (only the TableRow does).
-                // Ideally we would use the dirtyCell API:
-                //
-                // for (int i = c.getFrom(); i < c.getTo(); i++) {
-                //     flow.setCellDirty(i);
-                // }
+                // updated internal values that should be shown visually)
                 itemCount = 0;
                 break;
             } else if (c.getRemovedSize() == itemCount) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Mon Apr 28 13:32:22 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Mon Apr 28 14:04:45 2014 -0700
@@ -57,7 +57,6 @@
 import sun.util.logging.PlatformLogger;
 import java.util.AbstractList;
 import java.util.ArrayList;
-import java.util.BitSet;
 import java.util.List;
 
 /**
@@ -943,24 +942,6 @@
             lastHeight = -1;
         }
 
-        if (! dirtyCells.isEmpty()) {
-            for (int count = 0; count < dirtyCells.cardinality(); count++) {
-                int index = dirtyCells.nextSetBit(0);
-                T cell = cells.get(index);
-                // updateIndex(-1) works for TableView, but breaks ListView.
-                // For now, the TableView just does not use the dirtyCells API
-//                cell.updateIndex(-1);
-                if (cell != null) {
-                    cell.requestLayout();
-                }
-                dirtyCells.clear(index);
-            }
-
-            setMaxPrefBreadth(-1);
-            lastWidth = -1;
-            lastHeight = -1;
-        }
-
         final boolean hasSizeChange = sizeChanged;
         boolean recreatedOrRebuilt = needsRebuildCells || needsRecreateCells || sizeChanged;
 
@@ -2383,7 +2364,6 @@
     private boolean needsRebuildCells = false; // when cell contents have changed
     private boolean needsCellsLayout = false;
     private boolean sizeChanged = false;
-    private final BitSet dirtyCells = new BitSet();
     
     public void reconfigureCells() {
         needsReconfigureCells = true;
@@ -2405,11 +2385,6 @@
         requestLayout();
     }
 
-    public void setCellDirty(int index) {
-        dirtyCells.set(index);
-        requestLayout();
-    }
-
     private static final double GOLDEN_RATIO_MULTIPLIER = 0.618033987;
 
     private double getPrefBreadth(double oppDimension) {