removing vias from a copy of the list to avoid to invalidate the iterators in C++

This commit is contained in:
easyw
2019-11-05 10:07:20 +01:00
parent f3d0485ff7
commit da2a1335e2
2 changed files with 7 additions and 6 deletions

View File

@ -349,11 +349,12 @@ STEP = '-'
# timestmap again available # timestmap again available
#target_tracks = filter(lambda x: (x.GetNetname().upper() == self.netname), self.pcb.GetTracks()) #target_tracks = filter(lambda x: (x.GetNetname().upper() == self.netname), self.pcb.GetTracks())
target_tracks = filter(lambda x: (x.GetNetname() == self.netname), self.pcb.GetTracks()) target_tracks = filter(lambda x: (x.GetNetname() == self.netname), self.pcb.GetTracks())
for via in target_tracks: target_tracks_cp = list(target_tracks)
# pprint.pprint(via.GetTimeStamp()) l = len (target_tracks_cp)
if via.Type() == PCB_VIA_T: for i in range(l):
if via.GetTimeStamp() == 33: if target_tracks_cp[i].Type() == PCB_VIA_T:
self.pcb.RemoveNative(via) if target_tracks_cp[i].GetTimeStamp() == 33:
self.pcb.RemoveNative(target_tracks_cp[i])
self.RefillBoardAreas() self.RefillBoardAreas()
return # no need to run the rest of logic return # no need to run the rest of logic

View File

@ -71,7 +71,7 @@ class FillAreaAction(pcbnew.ActionPlugin):
PopulateNets("GND", a) PopulateNets("GND", a)
modal_result = a.ShowModal() modal_result = a.ShowModal()
if modal_result == wx.ID_OK: if modal_result == wx.ID_OK:
wx.LogMessage('Via Stitching: Version 1.4') wx.LogMessage('Via Stitching: Version 1.5')
if 1: # try: if 1: # try:
fill = FillArea.FillArea() fill = FillArea.FillArea()
fill.SetStepMM(float(a.m_StepMM.GetValue().replace(',', '.'))) fill.SetStepMM(float(a.m_StepMM.GetValue().replace(',', '.')))