Don't re-add item to screen if it wasn't there to begin with.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16184
This commit is contained in:
parent
7eb98a9863
commit
07ee44740b
|
@ -677,11 +677,12 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
SCH_COMMIT commit( GetParent() );
|
||||
SCH_SCREEN* currentScreen = GetParent()->GetScreen();
|
||||
bool replaceOnCurrentScreen;
|
||||
wxCHECK( currentScreen, false );
|
||||
|
||||
// This needs to be done before the LIB_ID is changed to prevent stale library symbols in
|
||||
// the schematic file.
|
||||
currentScreen->Remove( m_symbol );
|
||||
replaceOnCurrentScreen = currentScreen->Remove( m_symbol );
|
||||
|
||||
// save old cmp in undo list if not already in edit, or moving ...
|
||||
if( m_symbol->GetEditFlags() == 0 )
|
||||
|
@ -844,6 +845,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
}
|
||||
|
||||
if( replaceOnCurrentScreen )
|
||||
currentScreen->Append( m_symbol );
|
||||
|
||||
if( !commit.Empty() )
|
||||
|
|
Loading…
Reference in New Issue