From 788f31d743af16c008274c974dfd33dbbba93fe4 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 7 Jul 2020 20:48:21 -0400 Subject: [PATCH] Fix import of Eagle schematics Old project needs to be unloaded before schematic is reset, then new project has to be loaded before doing the import Fixes https://gitlab.com/kicad/code/kicad/-/issues/4836 --- eeschema/files-io.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 7779f258b7..c0889bf664 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -590,9 +590,17 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent ) if( setProject ) { + GetSettingsManager()->SaveProject(); + Schematic().SetProject( nullptr ); + GetSettingsManager()->UnloadProject( &Prj() ); + + Schematic().Reset(); + wxFileName projectFn( dlg.GetPath() ); projectFn.SetExt( ProjectFileExtension ); GetSettingsManager()->LoadProject( projectFn.GetFullPath() ); + + Schematic().SetProject( &Prj() ); } // For now there is only one import plugin @@ -785,8 +793,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) try { - Schematic().Reset(); - SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) ); Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) ); @@ -813,6 +819,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) Schematic().Root().SetFileName( newfilename.GetFullPath() ); GetScreen()->SetFileName( newfilename.GetFullPath() ); GetScreen()->SetModify(); + SaveProjectSettings(); UpdateFileHistory( aFileName );