From 52fceb3243bbf071434ae2492adecf6b84cc0a4b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 29 May 2018 19:57:18 +0200 Subject: [PATCH] Eeschema: sheet filename renaming: fix a old issue that can set incorrect filenames in sheets inside a complex hierarchy. Fixes: lp:1773500 https://bugs.launchpad.net/kicad/+bug/1773500 --- eeschema/sheet.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 6f581f309f..d255c81b9f 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -214,7 +214,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy ) if( renameFile ) { - aSheet->GetScreen()->SetFileName( newFilename ); + // If the the associated screen is shared by more than one sheet, do not + // change the filename of the corresponding screen here. + // (a new screen will be created later) + // if it is not shared, update the filename + if( aSheet->GetScreenCount() <= 1 ) + aSheet->GetScreen()->SetFileName( newFilename ); try {