← Back to team overview

kicad-developers team mailing list archive

Re: Recent change to LayerIDs

 

Hi Jeff-

Yes, you are right.  That was meant to be temporary to track an issue I've
been seeing with swapping layers while switching between GAL and Legacy but
I accidentally pushed it with the zoom patch.  That said, background layer
is a color, and Jon added the correct color checks to
GetLayerColor/SetLayerColor late last year, so I think the correct action
here is to remove the cast from the color calls.  I've pushed this to clear
the assert in debug builds but if this feels like the wrong path, I'm happy
to revert as well.

On the signed/unsigned, the unsigned cast provides protection against
referencing invalid table indices.  I'm sure you caught this but we'll need
a second check against those for certain calls.

-S

Am Mi., 30. Mai 2018 um 12:59 Uhr schrieb Jeff Young <jeff@xxxxxxxxx>:

> Hi Seth,
>
> Your recent change to the assert in ToLAYER_ID() is going to cause issues.
>
> Was there some failure we weren’t catching?
>
> The reason we need it to be less restrictive is because the PCB background
> was put into the GAL range but is actually a board layer.  I suppose we
> could check against it specifically in addition to PCB_LAYER_ID_COUNT.
>  (We could also move the background into the proper set, but I think that
> might be a little too risky for 5.0.)
>
> (FWIW, the unsigned is also an issue as there are two negative layers
> which are legal.  I fixed that in my 6.0 tree.)
>
> Cheers,
> Jeff.
>

References