From 21c9fbe5ee4f79b49618b906f84d88522fe8dfc2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 17 Dec 2002 23:22:38 +0000 Subject: [PATCH] reset virtual root to NULL in DeleteAllItems() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/treectrl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 347ed299f5..2cab63afad 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -1659,9 +1659,14 @@ void wxTreeCtrl::DeleteChildren(const wxTreeItemId& item) void wxTreeCtrl::DeleteAllItems() { - // delete stored root item. - delete GET_VIRTUAL_ROOT(); + // delete the "virtual" root item. + if ( GET_VIRTUAL_ROOT() ) + { + delete GET_VIRTUAL_ROOT(); + m_pVirtualRoot = NULL; + } + // and all the real items if ( !TreeView_DeleteAllItems(GetHwnd()) ) { wxLogLastError(wxT("TreeView_DeleteAllItems"));