From 7e778c9856486d072b10d8b722b655dd2692ac28 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 27 Dec 2022 10:07:52 -0500 Subject: [PATCH] KiWay: Make sure to mark closed windows as closed Also make sure to veto project import if we couldn't close the existing project. Fixes https://gitlab.com/kicad/code/kicad/-/issues/13215 Maybe also fixes some other weird crashes, we'll see. --- common/kiway.cpp | 3 +++ kicad/import_project.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/kiway.cpp b/common/kiway.cpp index ec0a0226be..92760f68b9 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -466,7 +466,10 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce ) return true; if( frame->NonUserClose( doForce ) ) + { + m_playerFrameId[aFrameType] = wxID_NONE; return true; + } return false; } diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index ea705b4245..ea59cac755 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -60,7 +60,8 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle, // OK, we got a new project to open. Time to close any existing project before we go on // to collect info about where to put the new one, etc. Otherwise the workflow is kind of // disjoint. - CloseProject( true ); + if( !CloseProject( true ) ) + return; IMPORT_PROJ_HELPER importProj( this, schdlg.GetPath(), aSchFileExtension, aPcbFileExtension );