Avoid referencing parents after deletion
We look at the parent when deleting EDA_ITEMs but when clearing the test sheet, we delete the sheet before the pin, causing a use-after-free. Avoid this by setting parents to null in this case Fixes https://gitlab.com/kicad/code/kicad/-/issues/17961
This commit is contained in:
parent
aeadec40b7
commit
b2e0c2606f
|
@ -106,7 +106,11 @@ PANEL_EESCHEMA_COLOR_SETTINGS::~PANEL_EESCHEMA_COLOR_SETTINGS()
|
||||||
delete m_currentSettings;
|
delete m_currentSettings;
|
||||||
|
|
||||||
for( EDA_ITEM* item : m_previewItems )
|
for( EDA_ITEM* item : m_previewItems )
|
||||||
|
{
|
||||||
|
// Avoid referencing items after they are deleted (we don't control order)
|
||||||
|
item->SetParent( nullptr );
|
||||||
delete item;
|
delete item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue