Fixed a use-after-free problem in object list
this was uncovered by ASAN when attempting to Delete All objects with multiple instances
This commit is contained in:
parent
72ba890091
commit
dc80616bf6
1 changed files with 5 additions and 1 deletions
|
@ -806,8 +806,12 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item)
|
|||
if (node_parent) {
|
||||
if (node->m_type & (itInstanceRoot|itLayerRoot))
|
||||
{
|
||||
for (int i = node->GetChildCount() - 1; i >= (node->m_type & itInstanceRoot ? 1 : 0); i--)
|
||||
// node can be deleted by the Delete, let's check its type while we safely can
|
||||
bool is_instance_root = (node->m_type & itInstanceRoot);
|
||||
|
||||
for (int i = node->GetChildCount() - 1; i >= (is_instance_root ? 1 : 0); i--)
|
||||
Delete(wxDataViewItem(node->GetNthChild(i)));
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue