← Back to team overview

kicad-developers team mailing list archive

Connection graph question


I'm guessing this is primarily a question for Jon but maybe someone else
can answer my question.  My recent symbol inheritance merge revealed
that the connection graph code has a serious fragility issue.  This
comment in the updateItemConnectivity function raised a red flag:

// Assumption: we don't need to call UpdatePins() here because anything
// that would change the pins of the component will have called it already

It turns out this assumption was not only wrong, it was really wrong.
Now that the LIB_PART of the SCH_COMPONENT is no longer a pointer link
but an actual copy of the library symbol, any change to the underlying
library symbol will result in stale pin map pointers.  This is what has
been causing all of the crash bugs.  I cannot believe that we haven't
had more issues.  The only thing that saved us was as long as the
original LIB_PART pointer was around somewhere, it wouldn't crash even
if the connection information was completely wrong.  I think I have
fixed everyplace where the LIB_PART copy is changed in SCH_COMPONENT but
that still leaves the issue of keeping the connection graph up to date.
There are lots of places in the code where we call UpdateSymbolLinks().
This will replace every single library symbol copy in the schematic with
a new copy which will render the connect graph pointers completely out
of date.  What needs to be done to ensure the the connection graph is
not stale?  It appears to me that I have to call Recalulate( rootSheet,
true ) is the correct thing to do but this will perform a complete
rebuild of the connection graph.  I'm guessing that has a lot of
overhead involved in it.  Is there a better way that I'm missing here?



Follow ups