Delay initialisation of global EDA_ITEMs.
It causes issues with boost::uuid generation in some versions of boost.
This commit is contained in:
parent
f206db2041
commit
41b7c62c15
|
@ -41,7 +41,7 @@ const wxChar* const traceMask = wxT( "BOARD_CONNECTED_ITEM" );
|
|||
|
||||
|
||||
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
||||
BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM )
|
||||
BOARD_ITEM( aParent, idtype ), m_netinfo( NETINFO_LIST::OrphanedItem() )
|
||||
{
|
||||
m_localRatsnestVisible = true;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ bool BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode, bool aNoAssert )
|
|||
if( ( aNetCode >= 0 ) && board )
|
||||
m_netinfo = board->FindNet( aNetCode );
|
||||
else
|
||||
m_netinfo = &NETINFO_LIST::ORPHANED_ITEM;
|
||||
m_netinfo = NETINFO_LIST::OrphanedItem();
|
||||
|
||||
if( !aNoAssert )
|
||||
wxASSERT( m_netinfo );
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
DELETED_BOARD_ITEM g_DeletedItem;
|
||||
DELETED_BOARD_ITEM* g_DeletedItem = nullptr;
|
||||
|
||||
|
||||
/* This is an odd place for this, but CvPcb won't link if it is
|
||||
|
@ -735,7 +735,10 @@ BOARD_ITEM* BOARD::GetItem( void* aWeakReference )
|
|||
return drawing;
|
||||
|
||||
// Not found; weak reference has been deleted.
|
||||
return &g_DeletedItem;
|
||||
if( !g_DeletedItem )
|
||||
g_DeletedItem = new DELETED_BOARD_ITEM();
|
||||
|
||||
return g_DeletedItem;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1042,7 +1045,7 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
|
|||
wxASSERT( m_NetInfo.GetNetCount() > 0 );
|
||||
|
||||
if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
|
||||
return &NETINFO_LIST::ORPHANED_ITEM;
|
||||
return NETINFO_LIST::OrphanedItem();
|
||||
else
|
||||
return m_NetInfo.GetNetItem( aNetcode );
|
||||
}
|
||||
|
|
|
@ -468,7 +468,15 @@ public:
|
|||
|
||||
///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no
|
||||
///> board storing net list available.
|
||||
static NETINFO_ITEM ORPHANED_ITEM;
|
||||
static NETINFO_ITEM* OrphanedItem()
|
||||
{
|
||||
static NETINFO_ITEM* g_orphanedItem;
|
||||
|
||||
if( !g_orphanedItem )
|
||||
g_orphanedItem = new NETINFO_ITEM( nullptr, wxEmptyString, NETINFO_LIST::UNCONNECTED );
|
||||
|
||||
return g_orphanedItem;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show() const;
|
||||
|
|
|
@ -246,4 +246,3 @@ NETINFO_ITEM* NETINFO_MAPPING::iterator::operator->() const
|
|||
const int NETINFO_LIST::UNCONNECTED = 0;
|
||||
const int NETINFO_LIST::ORPHANED = -1;
|
||||
|
||||
NETINFO_ITEM NETINFO_LIST::ORPHANED_ITEM = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_LIST::UNCONNECTED );
|
||||
|
|
Loading…
Reference in New Issue