mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-06 20:05:13 +08:00
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
@ -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…
x
Reference in New Issue
Block a user