← Back to team overview

kicad-developers team mailing list archive

Re: Static initialization order fiasco

 

> Probably won't let you know.  Instead we'll just fix them.


OK. Thanks.
On Sunday, April 13, 2014 1:43 AM, Dick Hollenbeck <dick@xxxxxxxxxxx> wrote:
 
On 04/12/2014 02:56 PM, Alexander Lunev wrote:
> This week I tried to build recent revisions of KiCad. Every attempt I built them, Pcbnew
> fell with segmentation fault. I tried different versions of wxWidgets with different
> options. It did not help. It was especially strange because other developers told me that
> they can build and run the same revision (e.g. revision 4751) of Pcbnew normally.
> As it turned out, the issue is with undefined static initialization order.
> 
> lp:kicad revision 4792 and earlier:
> 
> class_netclass.cpp (line 39):
> const wxString NETCLASS::Default = wxT("Default");
> 
> class_netinfolist.cpp (line 283):
> NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString,
> NETINFO_LIST::UNCONNECTED );
> 
> class_netinfo_item.cpp (line 52...):
> NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent, const wxString& aNetName, int aNetCode ) :
>     m_NetCode( aNetCode ), m_Netname( aNetName ), m_ShortNetname( m_Netname.AfterLast( '/' ) )
> {
>     m_parent   = aParent;
>     m_RatsnestStartIdx = 0;     // Starting point of ratsnests of this net in a
>                                 // general buffer of ratsnest
>     m_RatsnestEndIdx   = 0;     // Ending point of ratsnests of this net
> 
>     m_NetClassName = NETCLASS::Default; // !!!!! here NETCLASS::Default may not be yet
> initialized !!!!!
>     m_NetClass = NULL;
> }


Nice catch.


> If there are other known similar places in the project, please, let us know. 

Probably won't let you know.  Instead we'll just fix them.

I have removed tons of static constructors in the last month, I'm sure over 200.  And even
more last night.


This is a reversal in trend however, in a positive direction.

BTW, this is not a fiasco.  Its just another of several bugs.




> It is difficult enough to review the whole project visually and moreover such bugs are subtle.
> 
> Alexander
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

References