Make sure hierarchy is up to date before checking duplicate sheet names

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8654
This commit is contained in:
Roberto Fernandez Bautista 2021-06-22 21:41:50 +01:00
parent ae612a454e
commit 466536d509
1 changed files with 3 additions and 0 deletions

View File

@ -1623,6 +1623,9 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
number = baseName.Last() + number; number = baseName.Last() + number;
baseName.RemoveLast(); baseName.RemoveLast();
} }
// Update hierarchy to include any other sheets we already added, avoiding
// duplicate sheet names
hierarchy = m_frame->Schematic().GetSheets();
//@todo: it might be better to just iterate through the sheet names //@todo: it might be better to just iterate through the sheet names
// in this screen instead of the whole hierarchy. // in this screen instead of the whole hierarchy.