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.
This commit is contained in:
Roberto Fernandez Bautista 2021-05-01 23:27:23 +01:00
parent 0f0c5c194b
commit cf2dc06add
2 changed files with 4 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;