wxTreeCtrl::Delete() bug corrected, sample expanded to test it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-11-26 19:10:01 +00:00
parent 8a0a092b3c
commit ff5bf2590f
3 changed files with 43 additions and 8 deletions

View File

@@ -51,7 +51,7 @@ public:
int image, int selImage,
wxTreeItemData *data );
inline ~wxGenericTreeItem();
~wxGenericTreeItem();
// trivial accessors
wxArrayTreeItems& GetChildren() { return m_children; }
@@ -688,6 +688,12 @@ wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parentId,
void wxTreeCtrl::Delete(const wxTreeItemId& itemId)
{
wxGenericTreeItem *item = itemId.m_pItem;
wxGenericTreeItem *parent = item->GetParent();
if ( parent )
{
parent->GetChildren().Remove(item);
}
delete item;