Thread safety.

(cherry picked from commit 80c447f869)
This commit is contained in:
Jeff Young
2025-07-14 10:13:58 +01:00
parent 2bd6e11dc0
commit dff78f8961
2 changed files with 15 additions and 15 deletions
+9 -12
View File
@@ -140,8 +140,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
if( !board()->GetDesignSettings().m_DRCEngine->RulesValid() )
{
WX_INFOBAR* infobar = frame->GetInfoBar();
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Show DRC rules" ),
wxEmptyString );
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Show DRC rules" ), wxEmptyString );
button->Bind( wxEVT_COMMAND_HYPERLINK,
std::function<void( wxHyperlinkEvent& aEvent )>(
@@ -153,8 +152,8 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
infobar->RemoveAllButtons();
infobar->AddButton( button );
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ),
10000, wxICON_WARNING );
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
wxICON_WARNING );
}
if( aReporter )
@@ -227,8 +226,7 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
if( !board()->GetDesignSettings().m_DRCEngine->RulesValid() )
{
WX_INFOBAR* infobar = frame->GetInfoBar();
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Show DRC rules" ),
wxEmptyString );
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Show DRC rules" ), wxEmptyString );
button->Bind( wxEVT_COMMAND_HYPERLINK,
std::function<void( wxHyperlinkEvent& aLocEvent )>(
@@ -240,8 +238,8 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
infobar->RemoveAllButtons();
infobar->AddButton( button );
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ),
10000, wxICON_WARNING );
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
wxICON_WARNING );
}
for( ZONE* zone : toFill )
@@ -280,14 +278,13 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& )>(
[this]( wxHyperlinkEvent& )
{
getEditFrame<PCB_EDIT_FRAME>()->ShowPreferences( _( "Editing Options" ),
_( "PCB Editor" ) );
getEditFrame<PCB_EDIT_FRAME>()->ShowPreferences( _( "Editing Options" ), _( "PCB Editor" ) );
} ) );
infobar->RemoveAllButtons();
infobar->AddButton( button );
infobar->ShowMessageFor( _( "Automatic refill of zones can be turned off in Preferences "
"if it becomes too slow." ),
infobar->ShowMessageFor( _( "Automatic refill of zones can be turned off in Preferences if it becomes "
"too slow." ),
10000, wxICON_INFORMATION, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
}
+6 -3
View File
@@ -194,7 +194,7 @@ private:
};
ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
m_board( aBoard ),
m_brdOutlinesValid( false ),
m_commit( aCommit ),
@@ -215,8 +215,7 @@ ZONE_FILLER::~ZONE_FILLER()
void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter )
{
m_progressReporter = aReporter;
wxASSERT_MSG( m_commit, wxT( "ZONE_FILLER must have a valid commit to call "
"SetProgressReporter" ) );
wxASSERT_MSG( m_commit, wxT( "ZONE_FILLER must have a valid commit to call SetProgressReporter" ) );
}
@@ -240,6 +239,10 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE*>& aZones, bool aCheck, wxWindow*
std::shared_ptr<CONNECTIVITY_DATA> connectivity = m_board->GetConnectivity();
// Ensure that multiple threads don't attempt to initialize the advanced cfg global at the same
// time.
ADVANCED_CFG::GetCfg();
// Rebuild (from scratch, ignoring dirty flags) just in case. This really needs to be reliable.
connectivity->ClearRatsnest();
connectivity->Build( m_board, m_progressReporter );