Project: SWT
Bug 143358 Tree items array don't shrink correctly
Reported: 2006-05-23 18:54:54 | Status: resolved fixed

build 3.2 RC5 In Tree.setItemCount (TreeItem parentItem, int count) the code computes a new shrinked array but doesn't assgined it. Here: //TODO - move shrink to paint event // shrink items array int lastIndex = items.length; for (int i=items.length; i>0; i--) { if (items [i-1] != null) { lastIndex = i; break; } } if (lastIndex < items.length - 4) { int length = Math.max (4, (lastIndex + 3) / 4 * 4); TreeItem [] newItems = new TreeItem [length]; System.arraycopy(items, 0, newItems, 0, Math.min(items.length, lastIndex)); } Is is missing a item = newItems; after the last system array copy. The GTK apparently doesn't shrink the array at all.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java