Fix crash when deleting items in wxTreeListCtrl

An invalid pointer was dereferenced after being deleted as ToDVI(item) checked
the item parent, i.e. used it, even though the item was already invalid.

Closes #17198.
This commit is contained in:
Vadim Zeitlin 2015-10-12 01:00:59 +02:00
parent 9dd48eab61
commit f9334fda39

View File

@ -733,7 +733,10 @@ void wxTreeListModel::DeleteItem(Node* item)
previous->DeleteNext();
}
ItemDeleted(ToDVI(parent), ToDVI(item));
// Note that the item is already deleted by now, so we can't use it in any
// way, e.g. by calling ToDVI(item) which does dereference the pointer, but
// ToNonRootDVI() that we use here does not.
ItemDeleted(ToDVI(parent), ToNonRootDVI(item));
}
void wxTreeListModel::DeleteAllItems()