Fix crash in wxDataViewTreeCtrl::DeleteAllItems() in wxGTK
Restore the checks for the model stamp, reverting the changes of
18594afe76
: we still need to ignore the
calls to at least iter_children() and iter_nth_child() model methods
that can be called from inside gtk_tree_view_set_model() when we reset
the model, as running these methods crashes when trying to use the
pointers to already deleted items.
For consistency and robustness, add checks for the model stamp to all
the methods and not just those two, just in case other ones end up being
called later in some way.
Also add a unit test checking that DeleteAllItems() doesn't crash and
does delete all items.
Closes #18533.
This commit is contained in:
@@ -262,4 +262,16 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
|
||||
CHECK( rectRoot == wxRect() );
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
|
||||
"wxDVC::DeleteAllItems",
|
||||
"[wxDataViewCtrl][delete]")
|
||||
{
|
||||
const wxDataViewItem top = m_dvc->GetTopItem();
|
||||
CHECK( m_dvc->GetChildCount(top) == 1 );
|
||||
|
||||
m_dvc->DeleteAllItems();
|
||||
|
||||
CHECK( m_dvc->GetChildCount(top) == 0 );
|
||||
}
|
||||
|
||||
#endif //wxUSE_DATAVIEWCTRL
|
||||
|
Reference in New Issue
Block a user