diff options
author | Veronika Irvine <veronika> | 2005-10-28 17:50:22 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2005-10-28 17:50:22 +0000 |
commit | c63ca636edfbea4cd55ccc07da414186be375ce0 (patch) | |
tree | cfade3e5494b954ee19d8567fcb5e95688064d2e | |
parent | 8fbd7ecbd4a6550241c0f116787a1a02d945acf2 (diff) | |
download | eclipse.platform.swt-c63ca636edfbea4cd55ccc07da414186be375ce0.tar.gz eclipse.platform.swt-c63ca636edfbea4cd55ccc07da414186be375ce0.tar.xz eclipse.platform.swt-c63ca636edfbea4cd55ccc07da414186be375ce0.zip |
Bug 113971 compare against count rather than index for growth
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java index 9843bb57e1..77672ff347 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java @@ -200,16 +200,6 @@ TreeItem _getItem (TreeItem parentItem, int index) { int count = getItemCount (parentItem); if (index < 0 || index >= count) return null; int [] ids = parentItem == null ? childIds : parentItem.childIds; - if (ids == null || index >= ids.length) { - int [] newIds = new int [index + 4]; - if (ids != null) System.arraycopy(ids, 0, newIds, 0, ids.length); - ids = newIds; - if (parentItem == null) { - childIds = ids; - } else { - parentItem.childIds = ids; - } - } int id = ids [index]; if (id == 0) { id = _getId (); @@ -692,8 +682,8 @@ void createItem (TreeItem item, TreeItem parentItem, int index) { item.id = id; items [id - 1] = item; int [] ids = parentItem == null ? childIds : parentItem.childIds; - if (ids == null || index >= ids.length) { - int [] newIds = new int [index + 4]; + if (ids == null || count + 1 > ids.length) { + int [] newIds = new int [count + 4]; if (ids != null) System.arraycopy (ids, 0, newIds, 0, ids.length); ids = newIds; if (parentItem == null) { @@ -2209,7 +2199,7 @@ void releaseItem (TreeItem item, boolean release) { if (index != -1) { System.arraycopy(ids, 0, ids, 0, index); System.arraycopy(ids, index+1, ids, index, ids.length - index - 1); - ids [ids.length -1] = 0; + ids [ids.length - 1] = 0; } if (parentItem != null) { parentItem.itemCount--; |