From e202dba3863dd5e6302ca6918e66cb27da2f919f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 17 Sep 2020 20:53:56 +0100 Subject: [PATCH] Be careful not to unload current project if settings imported from it. Fixes https://gitlab.com/kicad/code/kicad/issues/5684 --- pcbnew/dialogs/dialog_board_setup.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index c628b77970..b4ac65472e 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -185,7 +185,8 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) DisplayErrorMessage( this, msg, ioe.What() ); } - m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); + if( otherPrj != &m_frame->Prj() ) + m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); return; } @@ -228,11 +229,13 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) if( importDlg.m_SeveritiesOpt->GetValue() ) m_severities->ImportSettingsFrom( otherBoard->GetDesignSettings().m_DRCSeverities ); - otherBoard->ClearProject(); + if( otherPrj != &m_frame->Prj() ) + otherBoard->ClearProject(); } // Clean up and free memory before leaving - m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); + if( otherPrj != &m_frame->Prj() ) + m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); delete otherBoard; }