From ad03c8475d05f7f63a1a9082658100f78b93bb8f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Jan 2018 18:00:29 +0100 Subject: [PATCH] Revert "Fix crash when deleting all wxTreeListCtrl items with wxGTK3" This reverts commit 1dd102d741dc9858df2b7e933761ed7cc7a51093 as it introduced a crash in the same method when using generic wxDataViewCtrl implementation, e.g. under MSW, and is not necessary to avoid the crash with wxGTK3 any longer after the few previous commits. --- src/generic/treelist.cpp | 8 ++------ tests/controls/treelistctrltest.cpp | 9 --------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/generic/treelist.cpp b/src/generic/treelist.cpp index 3c6f26d955..6c599100ae 100644 --- a/src/generic/treelist.cpp +++ b/src/generic/treelist.cpp @@ -572,16 +572,12 @@ void wxTreeListModel::DeleteItem(Node* item) void wxTreeListModel::DeleteAllItems() { - // Note that this must be called before actually deleting the items as - // clearing GTK+ wxDataViewCtrl results in SELECTION_CHANGED events being - // sent and these events contain pointers to the model items, so they must - // still be valid. - Cleared(); - while ( m_root->GetChild() ) { m_root->DeleteChild(); } + + Cleared(); } const wxString& wxTreeListModel::GetItemText(Node* item, unsigned col) const diff --git a/tests/controls/treelistctrltest.cpp b/tests/controls/treelistctrltest.cpp index 02164ab3a1..d4a3ac96d6 100644 --- a/tests/controls/treelistctrltest.cpp +++ b/tests/controls/treelistctrltest.cpp @@ -39,7 +39,6 @@ private: CPPUNIT_TEST( Traversal ); CPPUNIT_TEST( ItemText ); CPPUNIT_TEST( ItemCheck ); - CPPUNIT_TEST( DeleteAll ); CPPUNIT_TEST_SUITE_END(); // Create the control with the given style. @@ -56,7 +55,6 @@ private: void Traversal(); void ItemText(); void ItemCheck(); - void DeleteAll(); // The control itself. @@ -233,11 +231,4 @@ void TreeListCtrlTestCase::ItemCheck() m_treelist->GetCheckedState(m_code) ); } -void TreeListCtrlTestCase::DeleteAll() -{ - m_treelist->DeleteAllItems(); - - CHECK( !m_treelist->GetFirstChild(m_treelist->GetRootItem()).IsOk() ); -} - #endif // wxUSE_TREELISTCTRL