Python: Copy board iterables to prevent segfaults
Python code like: for track in board.GetTracks(): board.Remove(track) Would delete tracks in the the underlying m_tracks while iterating over it. Fixes https://gitlab.com/kicad/code/kicad/-/issues/5192
This commit is contained in:
parent
7901d705ba
commit
1b0c274e22
|
@ -133,9 +133,11 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
|
|||
except:
|
||||
self.this = this
|
||||
|
||||
def GetFootprints(self): return self.Footprints()
|
||||
def GetDrawings(self): return self.Drawings()
|
||||
def GetTracks(self): return self.Tracks()
|
||||
# Convert these to lists to keep users from using them to delete
|
||||
# items in the iterable while looping over it
|
||||
def GetFootprints(self): return list(self.Footprints())
|
||||
def GetDrawings(self): return list(self.Drawings())
|
||||
def GetTracks(self): return list(self.Tracks())
|
||||
|
||||
def Save(self,filename):
|
||||
return SaveBoard(filename,self)
|
||||
|
|
Loading…
Reference in New Issue