Fix segfault when deleting sheet pins.
This commit is contained in:
parent
eea949ce0a
commit
c052b7f8ef
|
@ -189,6 +189,8 @@ void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem, bool aAppend )
|
|||
|
||||
if( aItem->Type() == SCH_SHEET_PIN_T )
|
||||
{
|
||||
RemoveFromScreen( aItem );
|
||||
|
||||
// This item is attached to a node, and is not accessible by the global list directly.
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) aItem->GetParent();
|
||||
wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
|
||||
|
|
|
@ -185,19 +185,20 @@ void SCH_SCREEN::DeleteItem( SCH_ITEM* aItem )
|
|||
|
||||
SetModify();
|
||||
|
||||
m_drawList.Remove( aItem );
|
||||
|
||||
if( aItem->Type() == SCH_SHEET_PIN_T )
|
||||
{
|
||||
// This structure is attached to a sheet, get the parent sheet object.
|
||||
SCH_SHEET_PIN* sheetPin = (SCH_SHEET_PIN*) aItem;
|
||||
SCH_SHEET* sheet = sheetPin->GetParent();
|
||||
wxCHECK_RET( sheet,
|
||||
wxT( "Sheet label parent not properly set, bad programmer!" ) );
|
||||
wxCHECK_RET( sheet, wxT( "Sheet label parent not properly set, bad programmer!" ) );
|
||||
sheet->RemovePin( sheetPin );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_drawList.Remove( aItem );
|
||||
delete aItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue