From b566f994bbc8bb4fa532c6f36dbc67cdb464652e Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 4 Sep 2023 23:22:39 -0400 Subject: [PATCH] Flip the RegisterSettings order to avoid legacy import crashes (cherry picked from commit 32c2135047b9db52b410535ec42453e6d627e2b4) --- eeschema/eeschema.cpp | 8 ++++++-- pcbnew/pcbnew.cpp | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 0c73c495c2..01dd496322 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -373,12 +373,16 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) // This is process-level-initialization, not project-level-initialization of the DSO. // Do nothing in here pertinent to a project! InitSettings( new EESCHEMA_SETTINGS ); - aProgram->GetSettingsManager().RegisterSettings( KifaceSettings() ); - // Register the symbol editor settings as well because they share a KiFACE and need to be // loaded prior to use to avoid threading deadlocks aProgram->GetSettingsManager().RegisterSettings( new SYMBOL_EDITOR_SETTINGS ); + // We intentionally register KifaceSettings after SYMBOL_EDITOR_SETTINGS + // In legacy configs, many settings were in a single editor config nd the migration routine + // for the main editor file will try and call into the now separate settings stores + // to move the settings into them + aProgram->GetSettingsManager().RegisterSettings( KifaceSettings() ); + start_common( aCtlBits ); if( !loadGlobalLibTable() ) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index aca594581f..d09d473cce 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -382,13 +382,18 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) // This is process-level-initialization, not project-level-initialization of the DSO. // Do nothing in here pertinent to a project! InitSettings( new PCBNEW_SETTINGS ); + aProgram->GetSettingsManager().RegisterSettings( new FOOTPRINT_EDITOR_SETTINGS ); + aProgram->GetSettingsManager().RegisterSettings( new EDA_3D_VIEWER_SETTINGS ); + + // We intentionally register KifaceSettings after FOOTPRINT_EDITOR_SETTINGS and EDA_3D_VIEWER_SETTINGS + // In legacy configs, many settings were in a single editor config and the migration routine + // for the main editor file will try and call into the now separate settings stores + // to move the settings into them aProgram->GetSettingsManager().RegisterSettings( KifaceSettings() ); // Register the footprint editor settings as well because they share a KiFACE and need to be // loaded prior to use to avoid threading deadlocks - aProgram->GetSettingsManager().RegisterSettings( new FOOTPRINT_EDITOR_SETTINGS ); aProgram->GetSettingsManager().RegisterSettings( new CVPCB_SETTINGS ); - aProgram->GetSettingsManager().RegisterSettings( new EDA_3D_VIEWER_SETTINGS ); start_common( aCtlBits );