GTK+ 3 (but not the generic version nor even GTK+ 2, apparently) sends "selection changed" event from gtk_tree_model_row_deleted() when deleting the currently selected row, which resulted in sending of wxEVT_TREELIST_SELECTION_CHANGED events with invalid wxTreeListItem, containing a dangling pointer, and a crash in the treelist sample when trying to dump it. Avoid this by clearing the model (and hence generating these events) first and deleting the items only afterwards. Also add a trivial unit test for wxTreeListCtrl::DeleteAllItems(), which doesn't even allow to reproduce this bug, but is still probably better to have than not to. Closes #18045.
7.5 KiB
7.5 KiB