kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26665
PATCH: Fix module pad sequence storage
Hi,
When openeing a kicad_pcb and storing it again, the pads in all
embedded modules get reversed. This is generally not really nice if
the pcb is managed by version control as it creates churn and could
make merges hard.
The problem is that pads are inserted rather than appended when
loading a pcb, so the pads are reversed on reading. The attached patch
that fixes that.
In general, there are more places of Add() where ADD_APPEND would
probably make more sense (e.g. in the copy constructor and the
assignment operator for MODULE), but I have not touched these here as
it requires more thorough inspection.
The fact that the default behavior is ADD_INSERT probably results in a
lot of trouble. I wonder when _ever_ someone means to insert things in
the beginning ? It feels like a rare operation. Maybe not making the
kind of insert operation a default parameter of the Add() function but
rather have the user decide every time which operation is needed -
this might reduce the accidents like this (in particular, since the
name of the operation, Add(), kindof more strongly implies appending).
(and I would almost bet that we don't even need ADD_INSERT so could
simplify a lot of places).
Anyway, something I might look into when having a little more time
(all BOARD_ITEM_CONTAINER have that, so there are probably more bugs
like this lurking). This is the second issue like that I noticed (last
year same with segments).
For now a simple patch that fixes the issue at hand.
Cheers,
Henner.
Attachment:
patch-fix-alternating-pad-save-sequence.patch.gz
Description: GNU Zip compressed data
Follow ups