Ensure driver connections are always properly initialized

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6694
This commit is contained in:
Jon Evans 2020-12-12 10:32:54 -05:00
parent bc484784fc
commit 6544dca056
2 changed files with 10 additions and 18 deletions

View File

@ -176,9 +176,16 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers )
// Cache driver connection
if( m_driver )
{
m_driver_connection = m_driver->Connection( &m_sheet );
m_driver_connection->ConfigureFromLabel( GetNameForDriver( m_driver ) );
m_driver_connection->SetDriver( m_driver );
m_driver_connection->ClearDirty();
}
else
{
m_driver_connection = nullptr;
}
if( aCreateMarkers && m_multiple_drivers )
{
@ -849,23 +856,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
}
}
if( !subgraph->ResolveDrivers() )
{
subgraph->m_dirty = false;
}
else
{
// Now the subgraph has only one driver
SCH_ITEM* driver = subgraph->m_driver;
SCH_SHEET_PATH sheet = subgraph->m_sheet;
SCH_CONNECTION* connection = driver->Connection( &sheet );
connection->ConfigureFromLabel( subgraph->GetNameForDriver( driver ) );
connection->SetDriver( driver );
connection->ClearDirty();
subgraph->m_dirty = false;
}
subgraph->ResolveDrivers();
subgraph->m_dirty = false;
}
return 1;

View File

@ -186,9 +186,9 @@ SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet,
{
connection = new SCH_CONNECTION( this );
m_connection_map.insert( std::make_pair( aSheet, connection ) );
connection->SetGraph( aGraph );
}
connection->SetGraph( aGraph );
connection->SetSheet( aSheet );
return connection;
}