Don't start filling zones with possibly stale caches.

Fixes https://gitlab.com/kicad/code/kicad/issues/8014
This commit is contained in:
Jeff Young 2021-03-25 17:19:29 +00:00
parent 262badf6ea
commit 3279e295ac
2 changed files with 15 additions and 10 deletions

View File

@ -641,6 +641,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
m_constraintMap.clear(); m_constraintMap.clear();
m_board->IncrementTimeStamp(); // Clear board-level caches
try // attempt to load full set of rules (implicit + user rules) try // attempt to load full set of rules (implicit + user rules)
{ {
loadImplicitRules(); loadImplicitRules();

View File

@ -95,26 +95,29 @@ void ZONE_FILLER_TOOL::singleShotRefocus( wxIdleEvent& )
void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter ) void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter )
{ {
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD_COMMIT commit( this );
std::vector<ZONE*> toFill; std::vector<ZONE*> toFill;
BOARD_COMMIT commit( this );
for( ZONE* zone : board()->Zones() ) for( ZONE* zone : board()->Zones() )
toFill.push_back( zone ); toFill.push_back( zone );
board()->IncrementTimeStamp(); // Clear caches
ZONE_FILLER filler( board(), &commit ); ZONE_FILLER filler( board(), &commit );
if( !board()->GetDesignSettings().m_DRCEngine->RulesValid() ) if( !board()->GetDesignSettings().m_DRCEngine->RulesValid() )
{ {
WX_INFOBAR* infobar = frame()->GetInfoBar(); WX_INFOBAR* infobar = frame->GetInfoBar();
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _("Show DRC rules"), wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _("Show DRC rules"),
wxEmptyString ); wxEmptyString );
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>( button->Bind( wxEVT_COMMAND_HYPERLINK,
[&]( wxHyperlinkEvent& aEvent ) std::function<void( wxHyperlinkEvent& aEvent )>(
{ [&]( wxHyperlinkEvent& aEvent )
getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog( _( "Rules" ) ); {
} ) ); frame->ShowBoardSetupDialog( _( "Rules" ) );
} ) );
infobar->RemoveAllButtons(); infobar->RemoveAllButtons();
infobar->AddButton( button ); infobar->AddButton( button );
@ -133,7 +136,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
if( filler.Fill( toFill ) ) if( filler.Fill( toFill ) )
{ {
commit.Push( _( "Fill Zone(s)" ), true ); // Allow undoing zone fill commit.Push( _( "Fill Zone(s)" ), true ); // Allow undoing zone fill
getEditFrame<PCB_EDIT_FRAME>()->m_ZoneFillsDirty = false; frame->m_ZoneFillsDirty = false;
} }
else else
{ {
@ -141,7 +144,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
} }
if( filler.IsDebug() ) if( filler.IsDebug() )
getEditFrame<PCB_EDIT_FRAME>()->UpdateUserInterface(); frame->UpdateUserInterface();
canvas()->Refresh(); canvas()->Refresh();