From be991cfcd67bce263dd852054350eb33c2fb8b7b Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Tue, 11 Jul 2023 03:00:16 +0500 Subject: [PATCH] Clear view before resetting schematic. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15159 (cherry picked from commit cab0db76f838961c1315161b5aac1871e28c00c4) --- eeschema/files-io.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 16c6577af6..7ac61f4ed7 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -638,6 +638,9 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent ) Schematic().SetProject( nullptr ); GetSettingsManager()->UnloadProject( &Prj(), false ); + // Clear view before destroying schematic as repaints depend on schematic being valid + SetScreen( nullptr ); + Schematic().Reset(); wxFileName projectFn( dlg.GetPath() );