mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
Thread safety.
This commit is contained in:
parent
a1c26e4516
commit
80c447f869
@ -86,8 +86,7 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRep
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Check Zones" ), 4,
|
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Check Zones" ), 4, PR_CAN_ABORT );
|
||||||
PR_CAN_ABORT );
|
|
||||||
m_filler->SetProgressReporter( reporter.get() );
|
m_filler->SetProgressReporter( reporter.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +140,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
|
|||||||
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,
|
button->Bind( wxEVT_COMMAND_HYPERLINK,
|
||||||
std::function<void( wxHyperlinkEvent& aEvent )>(
|
std::function<void( wxHyperlinkEvent& aEvent )>(
|
||||||
@ -154,8 +152,8 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
|
|||||||
infobar->RemoveAllButtons();
|
infobar->RemoveAllButtons();
|
||||||
infobar->AddButton( button );
|
infobar->AddButton( button );
|
||||||
|
|
||||||
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ),
|
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
|
||||||
10000, wxICON_WARNING );
|
wxICON_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
@ -164,8 +162,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Fill All Zones" ), 5,
|
reporter = std::make_unique<WX_PROGRESS_REPORTER>( aCaller, _( "Fill All Zones" ), 5, PR_CAN_ABORT );
|
||||||
PR_CAN_ABORT );
|
|
||||||
m_filler->SetProgressReporter( reporter.get() );
|
m_filler->SetProgressReporter( reporter.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +226,7 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
|
|||||||
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,
|
button->Bind( wxEVT_COMMAND_HYPERLINK,
|
||||||
std::function<void( wxHyperlinkEvent& aLocEvent )>(
|
std::function<void( wxHyperlinkEvent& aLocEvent )>(
|
||||||
@ -242,8 +238,8 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
|
|||||||
infobar->RemoveAllButtons();
|
infobar->RemoveAllButtons();
|
||||||
infobar->AddButton( button );
|
infobar->AddButton( button );
|
||||||
|
|
||||||
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ),
|
infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ), 10000,
|
||||||
10000, wxICON_WARNING );
|
wxICON_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ZONE* zone : toFill )
|
for( ZONE* zone : toFill )
|
||||||
@ -282,14 +278,13 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent )
|
|||||||
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& )>(
|
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& )>(
|
||||||
[this]( wxHyperlinkEvent& )
|
[this]( wxHyperlinkEvent& )
|
||||||
{
|
{
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->ShowPreferences( _( "Editing Options" ),
|
getEditFrame<PCB_EDIT_FRAME>()->ShowPreferences( _( "Editing Options" ), _( "PCB Editor" ) );
|
||||||
_( "PCB Editor" ) );
|
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
infobar->RemoveAllButtons();
|
infobar->RemoveAllButtons();
|
||||||
infobar->AddButton( button );
|
infobar->AddButton( button );
|
||||||
infobar->ShowMessageFor( _( "Automatic refill of zones can be turned off in Preferences "
|
infobar->ShowMessageFor( _( "Automatic refill of zones can be turned off in Preferences if it becomes "
|
||||||
"if it becomes too slow." ),
|
"too slow." ),
|
||||||
10000, wxICON_INFORMATION, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
|
10000, wxICON_INFORMATION, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +218,7 @@ ZONE_FILLER::~ZONE_FILLER()
|
|||||||
void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter )
|
void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
m_progressReporter = aReporter;
|
m_progressReporter = aReporter;
|
||||||
wxASSERT_MSG( m_commit, wxT( "ZONE_FILLER must have a valid commit to call "
|
wxASSERT_MSG( m_commit, wxT( "ZONE_FILLER must have a valid commit to call SetProgressReporter" ) );
|
||||||
"SetProgressReporter" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -243,6 +242,10 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE*>& aZones, bool aCheck, wxWindow*
|
|||||||
|
|
||||||
std::shared_ptr<CONNECTIVITY_DATA> connectivity = m_board->GetConnectivity();
|
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.
|
// Rebuild (from scratch, ignoring dirty flags) just in case. This really needs to be reliable.
|
||||||
connectivity->ClearRatsnest();
|
connectivity->ClearRatsnest();
|
||||||
connectivity->Build( m_board, m_progressReporter );
|
connectivity->Build( m_board, m_progressReporter );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user