Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2019-04-02 08:16:58 -0400
committerLakshmi Shanmugam2019-04-03 03:58:52 -0400
commit38954ab3133e4c45eaf24a5a0f0a5fb8b3142c41 (patch)
treefbf8439bdf5d633f331ccaab8fd30191c0caa312
parent55a6e588769d2914bcf7567f912ef89580c2411d (diff)
downloadeclipse.platform.swt-38954ab3133e4c45eaf24a5a0f0a5fb8b3142c41.tar.gz
eclipse.platform.swt-38954ab3133e4c45eaf24a5a0f0a5fb8b3142c41.tar.xz
eclipse.platform.swt-38954ab3133e4c45eaf24a5a0f0a5fb8b3142c41.zip
Bug 536468: NPE when adding 2nd entry in module path
Table.remove doesn't set null to all the disposed items. Change-Id: I90ac6133b28c963102fcb0ec88e231b4d8ae86a3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
index 8b22fe318f..40dfa25432 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
@@ -2232,7 +2232,7 @@ public void remove (int start, int end) {
if (start == 0 && end == itemCount - 1) {
removeAll ();
} else {
- int length = end - start + 1;
+ int numOfItemsRemoved = end - start + 1;
for (int i=start; i<=end; i++) {
TableItem item = items [i];
if (item != null) item.release (false);
@@ -2249,7 +2249,7 @@ public void remove (int start, int end) {
int newIndex = newCount++;
selection [newIndex] = selection [i];
if (selection [newIndex] > end) {
- selection [newIndex] -= length;
+ selection [newIndex] -= numOfItemsRemoved;
fix = true;
}
}
@@ -2257,11 +2257,11 @@ public void remove (int start, int end) {
if (fix) select (selection, newCount, true);
}
//fix items array
- System.arraycopy (items, start + length, items, start, itemCount - (start + length));
- for (int i = itemCount; i < items.length; i++) {
+ System.arraycopy (items, start + numOfItemsRemoved, items, start, itemCount - (start + numOfItemsRemoved));
+ for (int i = itemCount - numOfItemsRemoved; i < itemCount; i++) {
items [i] = null;
}
- itemCount -= length;
+ itemCount -= numOfItemsRemoved;
updateRowCount();
}
if (itemCount == 0) {

Back to the top