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 def0cd59ea
commit d9d1917785
2 changed files with 5 additions and 1 deletions

View File

@@ -589,6 +589,7 @@ Unix:
All (GUI):
- Fix hang when deleting columns from wxTreeListCtrl.
- Fix crash when deleting items from wxTreeListCtrl (Rexxar).
- Allow requesting modern (3.x+) OpenGL version in wxGLCanvas (Fabio Arnold).
- Allow using Ctrl-dragging to add to selection in wxGrid (Knut Petter Lehre).
- Fix several floating point rounding bugs in wxPropertyGrid (Artur Wieczorek).

View File

@@ -743,7 +743,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()