From: Vadim Zeitlin Date: Tue, 17 Dec 2002 23:22:38 +0000 (+0000) Subject: reset virtual root to NULL in DeleteAllItems() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bfedf6212c58824b38bffb7ebd9ec78479769141 reset virtual root to NULL in DeleteAllItems() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 66698a8537..a6fa885c52 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -1659,8 +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()) ) {