← Back to team overview

kicad-developers team mailing list archive

Re: Static initialization order fiasco

 

Rev 4799 should fix this particular issue for your toolchain.

The order of static constructors, although simply advertised as "uncertain", actually
depends on the order of objects being linked into the link image on some toolchains.

So just upgrading a toolchain can change this order, and suddenly expose a latent problem
that has been without concern for years.



The fix was to use

  const wxChar NETCLASS::Default[] = wxT( "Default" );

instead of

  const wxString NETCLASS::Default = wxT( "Default" );

This defers the construction of the wxString until actually used, and removes the wxString
static constructor from the race.





Follow ups

References