Recalculate ratsnest after zone fill

Push the mutex down into the ZONE::Fill() routine and set the
connectivity update to run after zone fills.  The connectivity update
cannot run while the mutex is locked for zone fills.

Fixes https://gitlab.com/kicad/code/kicad/issues/9993
This commit is contained in:
Seth Hillbrand 2021-12-14 13:35:46 -08:00
parent 7f419e4468
commit 401de24274
3 changed files with 20 additions and 18 deletions

View File

@ -129,8 +129,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
// Only auto-refill zones here if in user preferences
if( Settings().m_AutoRefillZones )
{
std::lock_guard<KISPINLOCK> lock( GetBoard()->GetConnectivity()->GetLock() );
if( zones_to_refill.size() )
{
ZONE_FILLER filler( GetBoard(), &commit );
@ -143,6 +141,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
if( !filler.Fill( zones_to_refill ) )
{
GetBoard()->GetConnectivity()->Build( GetBoard() );
// User has already OK'ed dialog so we're going to go ahead and commit even if the
// fill was cancelled.
}

View File

@ -82,10 +82,9 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRep
filler.SetProgressReporter( reporter.get() );
}
std::lock_guard<KISPINLOCK> lock( board()->GetConnectivity()->GetLock() );
if( filler.Fill( toFill, true, aCaller ) )
{
board()->GetConnectivity()->Build( board() );
commit.Push( _( "Fill Zone(s)" ), false );
getEditFrame<PCB_EDIT_FRAME>()->m_ZoneFillsDirty = false;
}
@ -155,10 +154,10 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
filler.SetProgressReporter( reporter.get() );
}
std::lock_guard<KISPINLOCK> lock( board()->GetConnectivity()->GetLock() );
{
if( filler.Fill( toFill ) )
{
board()->GetConnectivity()->Build( board() );
commit.Push( _( "Fill Zone(s)" ), true ); // Allow undoing zone fill
frame->m_ZoneFillsDirty = false;
}
@ -169,6 +168,7 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
if( filler.IsDebug() )
frame->UpdateUserInterface();
}
canvas()->Refresh();
m_fillInProgress = false;
@ -211,10 +211,11 @@ int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent )
reporter = std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Fill Zone" ), 4 );
filler.SetProgressReporter( reporter.get() );
std::lock_guard<KISPINLOCK> lock( board()->GetConnectivity()->GetLock() );
if( filler.Fill( toFill ) )
{
board()->GetConnectivity()->Build( board() );
commit.Push( _( "Fill Zone(s)" ), true ); // Allow undoing zone fill
}
else
commit.Revert();

View File

@ -77,6 +77,8 @@ void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter )
bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aParent )
{
std::lock_guard<KISPINLOCK> lock( m_board->GetConnectivity()->GetLock() );
std::vector<std::pair<ZONE*, PCB_LAYER_ID>> toFill;
std::vector<CN_ZONE_ISOLATED_ISLAND_LIST> islandsList;