From 06f1b70464321aad204a8eb48b9f8a43a982f15d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 19 Jan 2011 10:46:19 +0000 Subject: [PATCH] Avoid collapsing the hidden root in wxTreeCtrl::CollapseAllChildren(). The hidden root item can't be collapsed so don't even try to do it as this just results in an assert. This is similar to the changes of r48097 in ExpandAllChildren(). Closes #12881. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/treebase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index e573f9cec9..57cfed1d19 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -323,8 +323,10 @@ void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item) CollapseAllChildren(idCurr); } - // then collapse this element too - Collapse(item); + // then collapse this element too unless it's the hidden root which can't + // be collapsed + if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) ) + Collapse(item); Thaw(); } -- 2.45.2