]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid collapsing the hidden root in wxTreeCtrl::CollapseAllChildren().
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Jan 2011 10:46:19 +0000 (10:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Jan 2011 10:46:19 +0000 (10:46 +0000)
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

index e573f9cec926a0e2699193529d86aa4e86ae9f96..57cfed1d197ac6eb8e2a59a72fefbbfd9821bc4d 100644 (file)
@@ -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();
 }