From cf2dc06addc07af15487465500135f9bdf53f3d5 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Sat, 1 May 2021 23:27:23 +0100 Subject: [PATCH] Fix latent bugs in SCHEMATIC and SCH_SEXPR_PLUGIN Noticed after writing the qa test: when loading a file immediately after having loaded a previous one, it was resulting in a nullptr exception. --- eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 2 ++ eeschema/schematic.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index ebf5acec00..511cab1734 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -455,6 +455,8 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema wxASSERT( m_currentPath.size() == 1 ); // only the project path should remain + m_currentPath.pop(); // Clear the path stack for next call to Load + return sheet; } diff --git a/eeschema/schematic.cpp b/eeschema/schematic.cpp index 78ff2d827c..a67f080fdc 100644 --- a/eeschema/schematic.cpp +++ b/eeschema/schematic.cpp @@ -60,6 +60,8 @@ void SCHEMATIC::Reset() project.m_ErcSettings = nullptr; project.m_SchematicSettings = nullptr; + + m_project = nullptr; // clear the project, so we don't do this again when setting a new one } delete m_rootSheet;