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
(cherry picked from commit b2e0c2606f
)
This commit is contained in:
parent
6ecfa65c4c
commit
9f9fa0dd8d
|
@ -106,7 +106,11 @@ PANEL_EESCHEMA_COLOR_SETTINGS::~PANEL_EESCHEMA_COLOR_SETTINGS()
|
|||
delete m_currentSettings;
|
||||
|
||||
for( EDA_ITEM* item : m_previewItems )
|
||||
{
|
||||
// Avoid referencing items after they are deleted (we don't control order)
|
||||
item->SetParent( nullptr );
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue