From dc3c6b2f39f10c21f49d227501daa4ddbf9f64f9 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 27 Jan 2020 06:29:54 -0800 Subject: [PATCH] Check recursion before appending We need to ensure that the appended sheet does not already exist in the parent hierarchy. We do this for new sheets but need to check for existing ones as well. Fixes #3806 | https://gitlab.com/kicad/code/kicad/issues/3806 (cherry picked from commit 7ac83ac64de432469fe93d2ca707acd8deb18af2) --- eeschema/sheet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 2c104c4105..927e36e454 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -737,7 +737,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, aHierarchy->LastScreen()->Remove( aSheet ); } - if( !LoadSheetFromFile( aSheet, aHierarchy, newFilename ) ) + if( !LoadSheetFromFile( aSheet, aHierarchy, newFilename ) + || checkSheetForRecursion( aSheet, aHierarchy ) ) { if( restoreSheet ) aHierarchy->LastScreen()->Append( aSheet );