diff options
author | Felipe Heidrich <fheidric> | 2006-05-24 19:04:37 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2006-05-24 19:04:37 +0000 |
commit | d584b24115c6fed4319e372dd38b61a06d5e3248 (patch) | |
tree | 11527b4ee992f77922183c03c42a6ee99576ad63 | |
parent | 6b4eb74d15e26618fcb4ad17ce13ebce86b30449 (diff) | |
download | eclipse.platform.swt-d584b24115c6fed4319e372dd38b61a06d5e3248.tar.gz eclipse.platform.swt-d584b24115c6fed4319e372dd38b61a06d5e3248.tar.xz eclipse.platform.swt-d584b24115c6fed4319e372dd38b61a06d5e3248.zip |
143236 - setItemCount(0) leaking TreeItems - 3.2 RC6 FIX
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java | 19 |
1 files changed, 10 insertions, 9 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 2eed51fa86..337964f176 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 @@ -2782,22 +2782,23 @@ void setItemCount (TreeItem parentItem, int count) { OS.SetDataBrowserCallbacks (handle, callbacks); int[] ids = parentItem == null ? childIds : parentItem.childIds; if (count < itemCount) { - int index = count; - while (index < ids.length) { + for (int index = ids.length - 1; index >= count; index--) { int id = ids [index]; if (id != 0) { TreeItem item = _getItem (id, false); - if (item != null) item.release (false); - if (parentItem == null || parentItem.getExpanded ()) { - if (OS.RemoveDataBrowserItems (handle, OS.kDataBrowserNoItem, 1, new int [] {id}, 0) != OS.noErr) { - break; + if (item != null && !item.isDisposed ()) { + item.dispose (); + } else { + if (parentItem == null || parentItem.getExpanded ()) { + if (OS.RemoveDataBrowserItems (handle, OS.kDataBrowserNoItem, 1, new int [] {id}, 0) != OS.noErr) { + error (SWT.ERROR_ITEM_NOT_REMOVED); + break; + } + visibleCount--; } - visibleCount--; } } - index++; } - if (index < ids.length) error (SWT.ERROR_ITEM_NOT_REMOVED); //TODO - move shrink to paint event // shrink items array int lastIndex = items.length; |