diff --git a/pcbnew/connectivity_data.h b/pcbnew/connectivity_data.h index fb614f07a3..898542eb51 100644 --- a/pcbnew/connectivity_data.h +++ b/pcbnew/connectivity_data.h @@ -34,6 +34,8 @@ #include #include +#include +#include class CN_CLUSTER; class CN_CONNECTIVITY_ALGO; @@ -57,8 +59,14 @@ struct CN_DISJOINT_NET_ENTRY struct CN_ZONE_ISOLATED_ISLAND_LIST { - ZONE_CONTAINER *m_zone; - std::vector m_islands; + CN_ZONE_ISOLATED_ISLAND_LIST( ZONE_CONTAINER* aZone ) : + m_zone( aZone ), + m_lastPolys( aZone->GetFilledPolysList() ) + {} + + ZONE_CONTAINER* m_zone; + const SHAPE_POLY_SET m_lastPolys; + std::vector m_islands; }; struct RN_DYNAMIC_LINE diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index dec08fe38f..4b8577975c 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -97,9 +97,7 @@ void ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) if( zone->GetIsKeepout() ) continue; - CN_ZONE_ISOLATED_ISLAND_LIST l; - l.m_zone = zone; - toFill.push_back( l ); + toFill.emplace_back( CN_ZONE_ISOLATED_ISLAND_LIST(zone) ); } for( unsigned i = 0; i < toFill.size(); i++ ) @@ -117,7 +115,6 @@ void ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) } m_next = 0; - m_out_of_date = false; m_count_done = 0; std::vector fillWorkers; @@ -132,9 +129,6 @@ void ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) ZONE_CONTAINER* zone = toFill[i].m_zone; fillSingleZone( zone, rawPolys, finalPolys ); - if( aCheck && zone->GetFilledPolysList().GetHash() != finalPolys.GetHash() ) - m_out_of_date.store( true ); - zone->SetRawPolysList( rawPolys ); zone->SetFilledPolysList( finalPolys ); zone->SetIsFilled( true ); @@ -170,6 +164,8 @@ void ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) connectivity->SetProgressReporter( m_progressReporter ); connectivity->FindIsolatedCopperIslands( toFill ); + bool outOfDate = false; + for( auto& zone : toFill ) { std::sort( zone.m_islands.begin(), zone.m_islands.end(), std::greater() ); @@ -181,11 +177,14 @@ void ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) } zone.m_zone->SetFilledPolysList( poly ); + + if( aCheck && zone.m_lastPolys.GetHash() != poly.GetHash() ) + outOfDate = true; } - if( aCheck && m_out_of_date ) + if( aCheck && outOfDate ) { - bool cancel = !IsOK( nullptr, _( "Zone fills may be out-of-date. Re-fill all zones?" ) ); + bool cancel = !IsOK( nullptr, _( "Zone fills are out-of-date. Re-fill?" ) ); if( m_progressReporter ) { diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index a166d1d714..b505f6ea24 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -122,7 +122,6 @@ private: std::atomic_size_t m_next; // An index into the vector of zones to fill. // Used by the variuos parallel thread sets during // fill operations. - std::atomic_bool m_out_of_date; std::atomic_size_t m_count_done; };