Clear view before resetting schematic.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15159

(cherry picked from commit cab0db76f8)
This commit is contained in:
Alex Shvartzkop 2023-07-11 03:00:16 +05:00
parent aab36d9b85
commit be991cfcd6
1 changed files with 3 additions and 0 deletions

View File

@ -638,6 +638,9 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
Schematic().SetProject( nullptr ); Schematic().SetProject( nullptr );
GetSettingsManager()->UnloadProject( &Prj(), false ); GetSettingsManager()->UnloadProject( &Prj(), false );
// Clear view before destroying schematic as repaints depend on schematic being valid
SetScreen( nullptr );
Schematic().Reset(); Schematic().Reset();
wxFileName projectFn( dlg.GetPath() ); wxFileName projectFn( dlg.GetPath() );