]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied #11106: wxGenericDirCtrl can get into a state where it will no longer expand
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Sep 2009 17:04:44 +0000 (17:04 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Sep 2009 17:04:44 +0000 (17:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/dirctrlg.cpp

index 3587660c1c1fea7b14325a1ac5fb9c21cab778d8..63b663923b40e698c802e03092abc45f4b1bd111 100644 (file)
@@ -785,19 +785,12 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId)
         return;
 
     data->m_isExpanded = false;
-    wxTreeItemIdValue cookie;
-    /* Workaround because DeleteChildren has disapeared (why?) and
-     * CollapseAndReset doesn't work as advertised (deletes parent too) */
-    child = m_treeCtrl->GetFirstChild(parentId, cookie);
-    while (child.IsOk())
-    {
-        m_treeCtrl->Delete(child);
-        /* Not GetNextChild below, because the cookie mechanism can't
-         * handle disappearing children! */
-        child = m_treeCtrl->GetFirstChild(parentId, cookie);
-    }
+
+    m_treeCtrl->Freeze();
     if (parentId != m_treeCtrl->GetRootItem())
-        m_treeCtrl->Collapse(parentId);
+        m_treeCtrl->CollapseAndReset(parentId);
+    m_treeCtrl->DeleteChildren(parentId);
+    m_treeCtrl->Thaw();
 }
 
 void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)