From 631980b0ab4f23522dd4641f74ae3ad7017b5467 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 16 Oct 2022 18:28:58 +0100 Subject: [PATCH] We were saving the old board pointer, but not updating the current one. This also makes a few other adjustments to order and to where we look for the enabled layers which should make it more robust. Fixes https://gitlab.com/kicad/code/kicad/issues/10925 --- pcbnew/board_stackup_manager/panel_board_stackup.cpp | 7 ++++--- pcbnew/dialogs/dialog_board_setup.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index 70ac28e8d5..1a00433143 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -694,7 +694,6 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync ) void PANEL_SETUP_BOARD_STACKUP::showOnlyActiveLayers() { - // Now enable/disable stackup items, according to the m_enabledLayers config // Calculate copper layer count from m_enabledLayers, and *do not use* brd_stackup // for that, because it is not necessary up to date @@ -1293,13 +1292,15 @@ bool PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow() void PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom( BOARD* aBoard ) { BOARD* savedBrd = m_board; + m_board = aBoard; + BOARD_DESIGN_SETTINGS* savedSettings = m_brdSettings; m_brdSettings = &aBoard->GetDesignSettings(); - m_enabledLayers = m_panelLayers->GetUILayerMask() & BOARD_STACKUP::StackupAllowedBrdLayers(); - synchronizeWithBoard( true ); + m_enabledLayers = m_board->GetEnabledLayers() & BOARD_STACKUP::StackupAllowedBrdLayers(); rebuildLayerStackPanel(); + synchronizeWithBoard( true ); computeBoardThickness(); m_brdSettings = savedSettings; diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index bc308b1d2d..ff63028317 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -236,8 +236,8 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent ) // separately, and stackup can be imported only after layers options if( importDlg.m_LayersOpt->GetValue() ) { - m_layers->ImportSettingsFrom( otherBoard ); m_physicalStackup->ImportSettingsFrom( otherBoard ); + m_layers->ImportSettingsFrom( otherBoard ); m_boardFinish->ImportSettingsFrom( otherBoard ); }